Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'd like that Varnish completely ignored certain URLs on my websites.

I.e., and

I have 4 websites on the same VCL, and all those websites are using the same URL structure so the only thing that changes is the domain itself, the URLs I want Varnish to ignore are the same.

I've tried:

sub vcl_recv {
    if (req.url ~ "^/fileuploader/\?"
        )  {

But it doesn't work. When trying to download a PDF through it I'm presented with a Varnish 503 Unavailable error (the same error I have if I didn't change the config). If I go through nginx directly using its port, it downloads fine.

Here's the varnishlog for this incident:

   16 ObjHeader    - Server: nginx/1.2.7
   16 ObjHeader    - Date: Wed, 17 Apr 2013 11:03:40 GMT
   16 ObjHeader    - Content-Type: application/pdf
   16 ObjHeader    - Content-Length: 1078550
   16 ObjHeader    - X-Powered-By: PHP/5.3.23-1~dotdeb.0
   16 ObjHeader    - Expires: Thu, 19 Nov 1981 08:52:00 GMT
   16 ObjHeader    - Set-Cookie: frontend=74go8sgckma5qrobnqc36pcjd4; expires=Wed, 17-Apr-2013 12:03:40 GMT; path=/;; httponly
   16 ObjHeader    - Pragma: public
   16 ObjHeader    - Cache-Control: must-revalidate, post-check=0, pre-check=0
   16 ObjHeader    - Content-Disposition: attachment; filename=File-1338990998.pdf
   16 ObjHeader    - Content-Encoding: gzip
   16 ObjHeader    - Vary: Accept-Encoding
   30 FetchError   - Resource temporarily unavailable
   16 FetchError   - straight insufficient bytes
share|improve this question

If you want to pass it absolutely untouched by Varnish, then the best option is return(pipe);, which basically tells Varnish to act as a dumb TCP proxy for the duration of the connection.

But the fact that you got a 503 response seems to imply that something else is wrong - can you provide the output from varnishlog when a request for that resource is made, if pipe mode doesn't do the trick?

share|improve this answer
Hi Shane, I've edited the OP to reflect the changes I made. If you could have a look that'd be great. – Pedro Peixoto Apr 17 '13 at 11:08
@PedroPeixoto It seems like pipe mode isn't occurring - where did you put that in your VCL config - is it your entire vcl_recv? Also, you've got a literal ? in your URL config, is that needed? Try "^/fileuploader/" instead? – Shane Madden Apr 18 '13 at 0:20
Shane, it was my entire vcl_recv indeed. I've since removed Varnish and to my biggest surprise, the websites load 40% faster. Either Varnish was misconfigured (most probably since I'm new to it), or since the disk is SSD and magento keeps most of the stuff on cache anyways, it's simply faster without Varnish. Either way I'm happy with the way it turned out, solved my problem and made the sites load faster. Thank you for your help, though. Although I don't need a solution right now, it is much appreciated. – Pedro Peixoto Apr 18 '13 at 9:37

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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