1

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

I.e., www.site1.com/fileuploader and www.site2.com/fileuploader

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/\?"
        )  {
        return(pipe);
    }
}

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=/; domain=www.site1.com; 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

1 Answer 1

0

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?

3
  • Hi Shane, I've edited the OP to reflect the changes I made. If you could have a look that'd be great. Apr 17, 2013 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? Apr 18, 2013 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. Apr 18, 2013 at 9:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .