Make sure X-Forwarded-Proto is set

Needed to cache http and https responses separately via Vary header
This commit is contained in:
Patrik Lundin 2024-10-15 16:29:31 +02:00
parent ad66745a90
commit 7286dec3ff
Signed by: patlu
GPG key ID: A0A812BA2249F294

View file

@ -43,11 +43,13 @@ sub vcl_recv {
# The usage of the proxy module is possible because haproxy is configured
# to set PROXY SSL headers for us.
if (proxy.is_ssl()) {
set req.http.X-Forwarded-Proto = "https";
std.syslog(180, "RECV: this is https");
if (req.http.host == "<%= @cache_secrets['customers'][@customer]['host'] %>") {
set req.backend_hint = destination_https;
}
} else {
set req.http.X-Forwarded-Proto = "http";
std.syslog(180, "RECV: this is http");
if (req.http.host == "<%= @cache_secrets['customers'][@customer]['host'] %>") {
set req.backend_hint = destination_http;