How Does vcl_error Work?

Comments

2 comments

  • Udaya Kumar

    Hi Squee,

    We have a requirement  to redirect any requests only from https://www.pn.com/ or https://www.pn.com/default.aspx to https://www.dn.com/pn/

    I have tried various methods (vcl & error) in the fastly fiddle and did not work as per the requirement.

    Here dn.com is the magento2 website where we use Fastly CDN.

    -U

    0
    Comment actions Permalink
  • Squee

    Hi Udaya,

    Thanks for reaching out. 

    We're happy to look at this with you, but I suspect we'll need more details to provide you with a solution. 

    As for the fiddle, the host on the fiddle is some variation on `exec<number>.fiddle.fastlydemo.net`. If you want to write VCL to be able to test redirects coming in from another host, try setting that host at the top of `vcl_recv`. That would look something like:

    set req.http.host = "www.pn.com";

    You would only want to do this in the fiddle to create the testing environment you need. Please don't put this line in your code unless you intend to rewrite the host for your origin to find.

    If you have further questions, please don't hesitate to open a ticket with support by emailing support@fastly.com.

    0
    Comment actions Permalink

Please sign in to leave a comment.