I'm using Varnish 2.1 (on Fastly if that matters), and I want to do something kind of weird:

I want to take a request to example.com/123456, and have fastly fetch the content from A_Backend, but on the path /longpath/123456.

Right now what I'm doing is in vcl_recv, I'm setting the backend, and returning pass. Then in vcl_pass, trying to rewrite the bereq.path.

Now I just end in a redirect loop. Any thoughts?


set req.url = "/longpath" + req.url

or regsuball.

  • This doesn't actually work because it changes the request, not what path is sent to the backend. – icco Apr 29 '16 at 19:57
  • Don't do it in vcl_pass, do it in recv. It'll work if you put it in recv, I've done it before. – Kirrus Apr 30 '16 at 23:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.