varnish-4

regex issue sending BAN request to Varnish server via curl

心已入冬 提交于 2021-01-27 13:25:21
问题 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 "https://oursite.com/product/item/(100|7|9||8|7|6|5|4|2|1)" <!DOCTYPE html> <html> <head> <title>200 Ban added</title> </head> <body> <h1>Error 200 Ban added</h1> <p>Ban added</p> <h3>Guru Meditation:</h3> <p>XID: 66211</p> <hr> <p>Varnish cache server</p> </body> </html> but

Varnish: purge if I have cookie in hash_data

纵饮孤独 提交于 2020-01-05 03:33:48
问题 Problem : I couldn't purge my page. After many time I decided to find out how purge works and find! As you can see we have used a new action - return(purge). This ends execution of vcl_recv and jumps to vcl_hash. This is just like we handle a regular request. When vcl_hash calls return(lookup) varnish will purge the object and then call vcl_purge. Here you have the option of adding any particular actions you want Varnish to take once it has purge the object. docs And then I understood that I

Varnish VCL: how can I switch on req.backend_hint?

ⅰ亾dé卋堺 提交于 2019-12-11 01:22:23
问题 I have the following VCL: vcl 4.0; import std; import directors; backend one { .host = "localhost"; .port = "3333"; } backend two { .host = "localhost"; .port = "3333"; } sub vcl_init { new random_director = directors.random(); random_director.add_backend(two, 10); random_director.add_backend(one, 8); } sub vcl_recv { std.log("start vcl_recv"); set req.backend_hint = random_director.backend(); if (req.backend_hint == one) { std.log("one"); } else if (req.backend_hint == two) { std.log("two");

Varnish + nginx + ELB 499 responses

我怕爱的太早我们不能终老 提交于 2019-12-03 23:03:40
问题 I am having varnish 4 server working with nginx as reverse proxy connected to ELB. Every 2 days or so my server is stop responding and I see 499 responses in nginx access.log restarting nginx is solving the problem. Why am I started to get these 499 responses? Why restarting nginx solving the issue? 回答1: I solved my issue after understanding two facts: 1) ELB instance has dynamic DNS name 2) nginx resolve DNS names only on reload/restart The problem was that the ELB changed its IP address and

Deliver stale content after error fetch in Varnish 4 before “probe” marks the server unhealth

佐手、 提交于 2019-12-01 11:03:57
I'm using stale-if-error to deliver stale content while the server is marked unhealthy looking at grace and keep object options in vcl_hit . The question is: Is it possible to deliver a cache object after entering the vcl subroutine vcl_backend_error (fresh request error). Actually, I deliver cached object at vcl_hit but looking at the next diagram, I don't see how it is possible to access the cached object of that request. Source: https://www.varnish-software.com/book/4.0/chapters/VCL_Basics.html When using the built-in VCL (see code bellow): # Built-in 'vcl_hit'. sub vcl_hit { if (obj.ttl >=

Deliver stale content after error fetch in Varnish 4 before “probe” marks the server unhealth

蓝咒 提交于 2019-12-01 07:52:44
问题 I'm using stale-if-error to deliver stale content while the server is marked unhealthy looking at grace and keep object options in vcl_hit . The question is: Is it possible to deliver a cache object after entering the vcl subroutine vcl_backend_error (fresh request error). Actually, I deliver cached object at vcl_hit but looking at the next diagram, I don't see how it is possible to access the cached object of that request. Source: https://www.varnish-software.com/book/4.0/chapters/VCL_Basics