Home » Fastly : How to set basic authentication for a specific page in Magento 2
Fastly : How to set basic authentication for a specific page in Magento 2

Fastly : How to set basic authentication for a specific page in Magento 2

Post navigation

2 Comments

  • Hi,

    if (req.url.path == “/test-page” &&
    !req.http.Authorization ~ “Basic YWRtaW46cGFzc3dvcmQxMjM=”) {
    return (synth(401, “Unauthorized”));
    }

    This is not working even it is not saving as VCL validation throwing error when trying to upload VCL to fastly. Is there any extra configuration required ?
    Adobe Commerce Version 2.4.7-p4

    • Please try this one.

      sub vcl_recv {
      if (req.url.path == “/test-page” &&
      !req.http.Authorization ~ “Basic YWRtaW46cGFzc3dvcmQxMjM=”) {
      return (synth(401, “Unauthorized”));
      }
      }

Leave a Reply

Your email address will not be published. Required fields are marked *

Magento 2: How to Get Base URL?

As a Magento developer, you are required to get a Magento 2 Base URL in various cases, Today we will see some of the examples of how we can get Base URL programmatically in Magento 2.

How to Use ViewModel in Magento 2: A Simple Guide

Instead of stuffing your block classes with business logic, you can use ViewModels to handle specific tasks related to data processing and then pass this data to your templates. This approach keeps your code clean, organized, and more maintainable.
back to top