nixos/oauth2_proxy_nginx: specify hostname in X-Auth-Request-Redirect

Fixes redirection after signing in when you use a single oauth2_proxy
instance for multiple domains.

X-Auth-Request-Redirect header is used to decide which URL to redirect
to after signing in. Specifying `request_uri` is enough in case you
need to redirect to the same domain that serves oauth2 callback
endpoint, but with multiple domains the you should include the scheme
and the host.
This commit is contained in:
Zhenya Vinogradov 2021-02-08 15:04:23 +03:00
parent c9f6a7f349
commit cc26d8592f

View file

@ -31,7 +31,7 @@ in
proxyPass = cfg.proxy;
extraConfig = ''
proxy_set_header X-Scheme $scheme;
proxy_set_header X-Auth-Request-Redirect $request_uri;
proxy_set_header X-Auth-Request-Redirect $scheme://$host$request_uri;
'';
};
locations."/oauth2/auth" = {