SOLVED: How do I serve cache from a different file path?

Comments

2 comments

  • Andrew Betts

    Definitely. You can do this with a little VCL, our configuration language:

    if (req.url == "/") { set req.url = "/feed/default"; } else if (req.url == "/news") { set req.url = "/feed/news"; } ... etc ...

    If you had thousands of these, or you wanted to adjust them dynamically via API calls, I'd recommend looking at using an Edge dictionary.

  • Carl Casbolt

    Thanks for the advice, I've added a custom VCL like this:

    sub vcl_recv {
    #FASTLY recv
    
      if (req.url == "/") {
        set req.url = "/feed/default";
      } else if (req.url == "/news") {
        set req.url = "/feed/news";
      } else {
        set req.url = "/feed/default";
      }
    }
    

    I added the final else block to catch any other URLs that might hit the address.

Please sign in to leave a comment.