Questions tagged [varnish-vcl]

The Varnish Configuration Language (VCL) is a small domain-specific language used to define request handling and caching policies for the Varnish HTTP accelerator. Do not confuse this with the Visual Component Library (VCL) used in Delphi and C++Builder. Use the "vcl" tag for questions related to those products.

The VCL language is a small domain-specific language designed to be used to define request handling and document caching policies for the Varnish HTTP accelerator. When a new configuration is loaded, the varnishd management process translates the VCL code to C and compiles it to a shared object which is then dynamically linked into the server process.

The VCL documentation can be found on the documentation site.

677 questions
52
votes
1 answer

What does Varnish hit-for-pass mean?

Varnish Version 3 has some objects for different operations. For example, pass is used when it has to retrieve data from backend, and it uses hit when it finds requesting content in cache. But I cant understand usage of hit-for-pass. When does…
Muneeb Nasir
  • 2,414
  • 4
  • 31
  • 54
22
votes
2 answers

How to debug VCL in varnish?

How can I print a log in VCL? Can I print log info on screen? Can I do like this? sub vcl_recv { .... log.info(req.http.host); // can i write a log here? .... }
lichengwu
  • 4,277
  • 6
  • 29
  • 42
20
votes
4 answers

Error 503 Backend fetch failed

I have this error in my site Error 503 Backend fetch failed Backend fetch failed Guru Meditation: XID: 526707 Varnish cache server Anyone know what may be the cause or how to find out what happens?
20
votes
1 answer

How do I get the req.url in vcl_backend_response?

My configs are based on Varnish 3.0 and I have been updating them. But I ran into a snag. vcl_fetch was replace to vcl_backend_response. Inside of vcl_fetch you used to be able to use req.url but not anymore inside of vcl_backend_response. So I am…
jnbdz
  • 4,863
  • 9
  • 51
  • 93
14
votes
4 answers

How to clear complete cache in Varnish?

I'm looking for a way to clear the cache for all domains and all URLs in Varnish. Currently, I would need to issue individual commands for each URLs, for example: curl -X PURGE http://example.com/url1 curl -X PURGE http://example.com/url1 curl -X…
laurent
  • 88,262
  • 77
  • 290
  • 428
14
votes
1 answer

What is Pipe mode and pass mode in varnish

what is pipe mode and pass mode in varnish-cache ... I have been trying to refer to this link to understand varnish. I somewhat understand pass but I'd like a better explanation.. http://spin.atomicobject.com/2013/01/16/speed-up-website-varnish/
J-D
  • 737
  • 1
  • 12
  • 27
13
votes
2 answers

Varnish: Guru Meditation

I'm installing Varnish following Varnish 3.0.2 documentation /etc/varnish/default.vcl backend default { .host = "127.0.0.1"; .port = "80"; .connect_timeout = 600s; .first_byte_timeout = 600s; .between_bytes_timeout =…
sparkle
  • 7,530
  • 22
  • 69
  • 131
13
votes
3 answers

Varnish automagically adding load balancer IP to X-Forwarded-For header

My request flow is as follows; HAProxy --> Varnish (4.0.1) --> Apache web backends When a new request comes in to HAProxy, the client's IP address is being added to the X-Forwarded-For header (which is good!). However, it looks like Varnish is…
Benjamin Smith
  • 877
  • 1
  • 9
  • 24
12
votes
7 answers

Stripping out select querystring attribute/value pairs so varnish will not vary cache by them

My goal is to "whitelist" certain querystring attributes and their values so varnish will not vary cache between the urls. Example: Url 1: http://foo.com/someproduct.html?utm_code=google&type=hello Url 2:…
runamok
  • 920
  • 1
  • 10
  • 24
11
votes
2 answers

Why isn't Varnish sending 304 unmodified when If-Modified-Since header is sent?

When sending a GET request directly to the backend with If-Modified-Since: Wed, 15 Feb 2012 07:25:00 CET set, Apache correctly returns a 304 with no content. When I send the same request through Varnish 3.0.2, it responds with a 200 and resends all…
Nic Cottrell
  • 9,401
  • 7
  • 53
  • 76
11
votes
2 answers

How to set Varnish to run on port 80. Malfunction of DAEMON_OPTS set in /etc/default/varnish

I have installed varnish and fallowed the exact instruction for setting it up, however, it is not working as expected. My /etc/default/varnish setup is: DAEMON_OPTS="-a :80 \ -T localhost:1234 \ -f /etc/varnish/default.vcl…
Lachezar Raychev
  • 2,113
  • 4
  • 24
  • 34
9
votes
3 answers

How to Set Varnish Cache-Control Headers

I am hoping someone can advise on the proper method for getting Varnish to send cache-control headers. Currently, my configuration is sending "Cache-Control: no-cache" to clients. Thanks in advance to anyone who might be able to help...
Kevin Gleeson
  • 113
  • 1
  • 1
  • 7
9
votes
1 answer

Change backend during retry in Varnish 4

I'd like to be able to change the backend on a retry in Varnish 4. We've got this working on a different (older) application using Varnish 3, but I haven't been able to figure it out for v4, nor find much documentation. The setup we want is to have…
Inukshuk
  • 187
  • 2
  • 13
9
votes
2 answers

Varnish won't recognize req.grace variable

I have a fresh install of Slackware 64 14bit, and looking through Varnish installation documentation I have all the dependencies installed and compiled varnish with no error (make check passes all tests) Yet, when I try to run varnish using varnishd…
Renato Massaro
  • 544
  • 1
  • 8
  • 18
9
votes
5 answers

How to inject environment variables in Varnish configuration

I have 2 environments variables : echo $FRONT1_PORT_8080_TCP_ADDR # 172.17.1.80 echo $FRONT2_PORT_8081_TCP_ADDR # 172.17.1.77 I want to inject them in a my default.vcl like : backend front1 { .host = $FRONT1_PORT_8080_TCP_ADDR; } But I got an…
manuquentin
  • 894
  • 1
  • 11
  • 19
1
2 3
45 46