Home » 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 *

back to top