media-proxy: Use subdomains instead of paths
This should help with isolating the different services.
This commit is contained in:
parent
80fcaab244
commit
47998fddd0
|
@ -1,6 +1,5 @@
|
||||||
{ config, lib, pkgs, ... }:
|
{ config, lib, pkgs, ... }:
|
||||||
let
|
let
|
||||||
port = 8888;
|
|
||||||
services = {
|
services = {
|
||||||
"media" = config.sops.secrets.media-proxy-auth.path;
|
"media" = config.sops.secrets.media-proxy-auth.path;
|
||||||
"media-sb" = config.sops.secrets.media-proxy-auth.path;
|
"media-sb" = config.sops.secrets.media-proxy-auth.path;
|
||||||
|
@ -24,26 +23,17 @@ in
|
||||||
enable = true;
|
enable = true;
|
||||||
commonHttpConfig = ''
|
commonHttpConfig = ''
|
||||||
map $http_referer $media_proxy_referer {
|
map $http_referer $media_proxy_referer {
|
||||||
~^http://localhost:8888/ "";
|
~^http://.*\.localhost/ "";
|
||||||
default $http_referer;
|
default $http_referer;
|
||||||
}
|
}
|
||||||
'';
|
'';
|
||||||
virtualHosts.media-proxy = {
|
virtualHosts = lib.mapAttrs'
|
||||||
serverName = "localhost";
|
(name: secret: lib.nameValuePair "${name}.localhost" {
|
||||||
listen = [
|
locations."/" = {
|
||||||
{ inherit port; addr = "127.0.0.1"; }
|
|
||||||
{ inherit port; addr = "[::1]"; }
|
|
||||||
];
|
|
||||||
locations = {
|
|
||||||
"/".extraConfig = ''
|
|
||||||
rewrite ^/__nginx-interactive-index-assets__/(.*)$ /media/__nginx-interactive-index-assets__/$1;
|
|
||||||
'';
|
|
||||||
} // lib.mapAttrs'
|
|
||||||
(name: secret: {
|
|
||||||
name = "/${name}/";
|
|
||||||
value = {
|
|
||||||
proxyPass = "https://${name}.sbruder.de/";
|
proxyPass = "https://${name}.sbruder.de/";
|
||||||
proxyWebsockets = true;
|
proxyWebsockets = true;
|
||||||
|
# they interfere here, as the host needs to be changed
|
||||||
|
recommendedProxySettings = false;
|
||||||
extraConfig = ''
|
extraConfig = ''
|
||||||
proxy_buffering off;
|
proxy_buffering off;
|
||||||
include ${secret};
|
include ${secret};
|
||||||
|
@ -56,5 +46,4 @@ in
|
||||||
services;
|
services;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue