media-proxy: Unset referer for same-site requests
The qBittorrent WebUI does not work with it set to a different host than the target. This implementation does not compromise security, because the referer is only unset if the real referer was the locally proxied page. All other referers are passed through verbatim.
This commit is contained in:
parent
a9b6a17818
commit
0e3bd19aa8
|
@ -20,6 +20,12 @@ in
|
||||||
systemd.services.nginx.after = [ "network-online.target" ];
|
systemd.services.nginx.after = [ "network-online.target" ];
|
||||||
services.nginx = {
|
services.nginx = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
commonHttpConfig = ''
|
||||||
|
map $http_referer $media_proxy_referer {
|
||||||
|
~^http://localhost:8888/ "";
|
||||||
|
default $http_referer;
|
||||||
|
}
|
||||||
|
'';
|
||||||
virtualHosts.media-proxy = {
|
virtualHosts.media-proxy = {
|
||||||
serverName = "localhost";
|
serverName = "localhost";
|
||||||
listen = [
|
listen = [
|
||||||
|
@ -40,6 +46,8 @@ in
|
||||||
proxy_buffering off;
|
proxy_buffering off;
|
||||||
include ${secret};
|
include ${secret};
|
||||||
charset utf-8;
|
charset utf-8;
|
||||||
|
proxy_set_header Referer $media_proxy_referer;
|
||||||
|
proxy_set_header Origin $media_proxy_referer;
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in a new issue