caching - Varnish HTTP 503 - backend sick - apache static files not cached -
we have varnish configured below:
- we have probe validation apache host , port, using context backend (application server / mod jk).
- we not using cluster , load balance configuration.
backend default { .host = "127.0.0.1"; .port = "80"; .max_connections = 300; .probe = { .url = "/webapp-context/healthcheck"; .interval = 60s; .timeout = 20s; .window = 5; .threshold = 3; } .first_byte_timeout = 5s; .connect_timeout = 5s; .between_bytes_timeout = 1s; }
- we have varnish cache specific contexts
- we dont have varnish cache staticfiles (www.domain.com/staticfiles/*), because static files on documentroot (apache).
sub vcl_recv { // not cache static files if ( req.url ~ "^(/staticfiles)" ) { return(pass); } // create cache if ( req.url ~ "^(/content/)" ) { unset req.http.cookie; return(hash); } ... ... }
so, problem is: have configured varnish "pass" static files context. , now, when our backend sick after probe validation, staticfiles context getting http 503 error, html pages still ok on varnish cache, without staticfiles.
are there way configure varnish keep serving static files apache, application server down?
you can setup additional backend definition not have health check specified. vcl include this:
backend static { .host = "127.0.0.1"; .port = "80"; .max_connections = 300; } # .. default backend probe here sub vcl_recv { # ... // not cache static files if ( req.url ~ "^(/staticfiles)" ) { set req.backend_hint = static; return(pass); } # ,,, }
Comments
Post a Comment