This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
vcl 4.0; | |
import std; | |
backend default { | |
// le hostname du nginx dans ma stack | |
.host = "front"; | |
.port = "80"; | |
} | |
sub vcl_recv { | |
set req.http.Surrogate-Capability = "abc=ESI/1.0"; | |
unset req.http.Cookie; | |
} | |
//Ensuite, ce block est appelé après la réception des headers de réponse. | |
//Nous supprimons le header et activons les ESI | |
sub vcl_backend_response { | |
if (beresp.http.Surrogate-Control ~ "ESI/1.0") { | |
unset beresp.http.Surrogate-Control; | |
set beresp.do_esi = true; | |
} | |
if (bereq.url ~ "\.(jpe?g|png|gif|pdf|tiff?|css|js|ttf|woff2?|otf|eot|svg)$") { | |
set beresp.ttl = std.duration(beresp.http.age+"s",0s) + 24h; | |
} | |
} | |
sub vcl_deliver { | |
if (obj.hits > 0) { | |
set resp.http.X-Cache = "HIT"; | |
} else { | |
set resp.http.X-Cache = "MISS"; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment