proxyauth: redirect correctly after login
This commit is contained in:
@@ -162,9 +162,9 @@ server {
|
||||
<% if (proxyAuth.enabled) { %>
|
||||
proxy_set_header X-App-ID "<%= proxyAuth.id %>";
|
||||
|
||||
location = /auth {
|
||||
location = /proxy-auth {
|
||||
internal;
|
||||
proxy_pass http://127.0.0.1:3001;
|
||||
proxy_pass http://127.0.0.1:3001/auth;
|
||||
proxy_pass_request_body off;
|
||||
proxy_set_header Content-Length "";
|
||||
}
|
||||
@@ -173,7 +173,9 @@ server {
|
||||
proxy_pass http://127.0.0.1:3001;
|
||||
}
|
||||
|
||||
error_page 401 403 /login;
|
||||
location @proxy-auth-login {
|
||||
return 302 /login?redirect=$request_uri;
|
||||
}
|
||||
<% } %>
|
||||
|
||||
location / {
|
||||
@@ -235,9 +237,10 @@ server {
|
||||
}
|
||||
<% } else if ( endpoint === 'app' ) { %>
|
||||
<% if (proxyAuth.enabled) { %>
|
||||
auth_request /auth;
|
||||
auth_request /proxy-auth;
|
||||
auth_request_set $auth_cookie $upstream_http_set_cookie;
|
||||
add_header Set-Cookie $auth_cookie;
|
||||
error_page 401 = @proxy-auth-login;
|
||||
<% } %>
|
||||
|
||||
proxy_pass http://127.0.0.1:<%= port %>;
|
||||
|
||||
Reference in New Issue
Block a user