Questions tagged [varnish-4]
180 questions
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
6
votes
2 answers
Is it possible to prevent caching based on the size of the backend response in Varnish?
We're caching for a problematic IIS server that sometimes just sends empty responses (0 bytes) instead of proper ones. Caching these responses would be a disaster, and we have no way of fixing the problem as it's not our server. Instead I'd like to…

Hubro
- 56,214
- 69
- 228
- 381
6
votes
1 answer
How to increase timeout between Varnish 4 and Nginx
Before asking this question, I searched Google and everywhere for hours trying to increase the connection timeout between Varnish 4 and Nginx but found no solution.
So here is my Varnish Config:
backend web1 {
.host = "192.168.1.21";
.port =…

skonsoft
- 1,786
- 5
- 22
- 43
5
votes
3 answers
Install Magento 2 and Varnish Cache on different server
I have 2 servers, one which has magento 2 installed (ip - 129.89.188.244 port 80) and Varnish on another (ip - 129.89.188.245 port 80)
My Varnish Configuration:
File /etc/default/varnish:-
DAEMON_OPTS="-a :80 \
-T 127.0.0.1:6082 \
…

Dhaval Bhavsar
- 495
- 5
- 17
5
votes
1 answer
Does Varnish cache 404s by default?
I was really surprised that I've had this much trouble finding this answer anywhere, but I can't.
With the built-in VCL in vcl_recv, etc., in Varnish 4.0+, does Varnish cache 404 responses by default?

jdotjdot
- 16,134
- 13
- 66
- 118
4
votes
0 answers
Make varnish cache a synthetic response for failing ESI
We use varnish 4 for caching and processing ESI. For ESI requests that return a 5XX backend error, we return an empty synthetic response.
That empty response should be cached for a few seconds, because currently every subsequent request to the same…

simon.ro
- 2,984
- 2
- 22
- 36
4
votes
2 answers
How to escape a double quote in varnish vcl
In vcl_recv I'm trying to send a 403 to requests that contain the following characters in the url: ",',<,>,(, and )
if(req.url ~ "[\'\<\>()].*\.html" ) {
return (synth(403, "Forbidden"));
}
everything works except the double quote "
I tried regex…

Boris Burgstaller
- 153
- 7
4
votes
1 answer
Varnish List all URLS in Cache
i am looking for a way to iterate over the whole cache and get a list of object URL's - that are currently inside the storage.
is there any varnish command i am missing. or does anyone have a good starting poiunt for iterating over objects from…

Helmut Januschka
- 1,578
- 3
- 16
- 34
4
votes
0 answers
Varnish 4 add ban on vcl_backend_response with some specific header
I have an Restful API with Varnish cache server over and I want to ban a specific endpoint from the backend, through some http headers.
To be more specific I will give an example:
I have updated an entity with some data, like: (PUT)…

birkof
- 634
- 1
- 6
- 14
3
votes
1 answer
regex issue sending BAN request to Varnish server via curl
I have been trying to send a BAN request via curl to the Varnish server to invalid cached content. The url contains some regex for Varnish to check against. I have been successfully sending this request:
1.
curl -X BAN…

RedGiant
- 4,444
- 11
- 59
- 146
3
votes
1 answer
Can I create a custom list of values like ACL in Varnish 4?
I'm using Varnish version 4. I'd like to know if VCL allows a custom and reusable list of values like ACL. I want to use it to check against visitors' cookies. If he is a moderator, don't serve cached content.
Cookie String:
…

RedGiant
- 4,444
- 11
- 59
- 146
3
votes
1 answer
varnish 4 grace time depending on backend health
I'm confused about where to set the grace time in varnish 4. I've seen example VCL's setting the grace time in vcl_recv
sub vcl_recv {
...
set req.http.grace = 60m;
...
}
others set it in vcl_hit
sub vcl_hit {
...
set obj.grace…

Matthias
- 141
- 9
2
votes
2 answers
Varnish http_req_hdr_len parameter not working for request header size > 8KB
I am trying to set the max request header size as 16KB in the varnishd command. Here is how varnishd command looks like:
/usr/sbin/varnishd \
-P /var/run/varnish.pid \
-f $VARNISH_VCL_CONF \
-a…

Vivek
- 137
- 2
- 17
2
votes
1 answer
Varnish (?) interrupting file download
On a debian buster server I have an apache2 web server with varnish as a cache in front of it, actually varnish listens on port 80 and fetches from apache which listens on port 8080.
Maybe since upgrade from stretch, file downloads aren't completed…

Paolo Benvenuto
- 385
- 4
- 15
2
votes
1 answer
Varnish-4 always returns x-cache: pass uncacheable
I'm currently setting up Varnish 4 for my domain for post request. But I can't figure out, why the request is always a "MISS" and I get x-cache as pass uncacheable.
Varnish Version
varnishd (varnish-4.1.11 revision…

daks999
- 21
- 3