forked from AkkomaGang/akkoma
Merge branch 'chore/pleroma-vcl' into 'develop'
Make it possible for Varnish logs to contain the true scheme used by clients See merge request pleroma/pleroma!3051
This commit is contained in:
commit
34029ffb90
1 changed files with 5 additions and 1 deletions
|
@ -1,3 +1,4 @@
|
||||||
|
# Recommended varnishncsa logging format: '%h %l %u %t "%m %{X-Forwarded-Proto}i://%{Host}i%U%q %H" %s %b "%{Referer}i" "%{User-agent}i"'
|
||||||
vcl 4.1;
|
vcl 4.1;
|
||||||
import std;
|
import std;
|
||||||
|
|
||||||
|
@ -14,8 +15,11 @@ acl purge {
|
||||||
sub vcl_recv {
|
sub vcl_recv {
|
||||||
# Redirect HTTP to HTTPS
|
# Redirect HTTP to HTTPS
|
||||||
if (std.port(server.ip) != 443) {
|
if (std.port(server.ip) != 443) {
|
||||||
|
set req.http.X-Forwarded-Proto = "http";
|
||||||
set req.http.x-redir = "https://" + req.http.host + req.url;
|
set req.http.x-redir = "https://" + req.http.host + req.url;
|
||||||
return (synth(750, ""));
|
return (synth(750, ""));
|
||||||
|
} else {
|
||||||
|
set req.http.X-Forwarded-Proto = "https";
|
||||||
}
|
}
|
||||||
|
|
||||||
# CHUNKED SUPPORT
|
# CHUNKED SUPPORT
|
||||||
|
@ -105,7 +109,7 @@ sub vcl_hash {
|
||||||
|
|
||||||
sub vcl_backend_fetch {
|
sub vcl_backend_fetch {
|
||||||
# Be more lenient for slow servers on the fediverse
|
# Be more lenient for slow servers on the fediverse
|
||||||
if bereq.url ~ "^/proxy/" {
|
if (bereq.url ~ "^/proxy/") {
|
||||||
set bereq.first_byte_timeout = 300s;
|
set bereq.first_byte_timeout = 300s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue