nginx: refactor the config
This commit is contained in:
@@ -326,13 +326,6 @@ server {
|
||||
}
|
||||
<% } %>
|
||||
|
||||
<% } else { %>
|
||||
location / {
|
||||
proxy_pass http://<%= ip %>:<%= port %>;
|
||||
}
|
||||
<% } %>
|
||||
|
||||
<% if (proxyAuth.enabled) { %>
|
||||
# workaround caching issue after /logout. if max-age is set, browser uses cache and user thinks they have not logged out
|
||||
# IMPORTANT: have to keep all the add_headers at top level here to avoid repeating all the add_headers and proxy_set_headers in location block
|
||||
proxy_hide_header Cache-Control;
|
||||
@@ -344,6 +337,11 @@ server {
|
||||
proxy_set_header X-Remote-User $user;
|
||||
proxy_set_header X-Remote-Email $email;
|
||||
proxy_set_header X-Remote-Name $name;
|
||||
|
||||
<% } else { %>
|
||||
location / {
|
||||
proxy_pass http://<%= ip %>:<%= port %>;
|
||||
}
|
||||
<% } %>
|
||||
|
||||
<% } else if ( endpoint === 'redirect' ) { %>
|
||||
@@ -393,18 +391,7 @@ server {
|
||||
proxy_ssl_verify off;
|
||||
proxy_pass $upstream;
|
||||
}
|
||||
<% } else { %>
|
||||
|
||||
location / {
|
||||
# without a variable, nginx will not start if upstream is down or unavailable
|
||||
resolver 127.0.0.1 valid=30s;
|
||||
set $upstream <%= upstreamUri %>;
|
||||
proxy_ssl_verify off;
|
||||
proxy_pass $upstream;
|
||||
}
|
||||
<% } %>
|
||||
|
||||
<% if (proxyAuth.enabled) { %>
|
||||
# workaround caching issue after /logout. if max-age is set, browser uses cache and user thinks they have not logged out
|
||||
# IMPORTANT: have to keep all the add_headers at top level here to avoid repeating all the add_headers and proxy_set_headers in location block
|
||||
proxy_hide_header Cache-Control;
|
||||
@@ -416,7 +403,18 @@ server {
|
||||
proxy_set_header X-Remote-User $user;
|
||||
proxy_set_header X-Remote-Email $email;
|
||||
proxy_set_header X-Remote-Name $name;
|
||||
|
||||
<% } else { %>
|
||||
|
||||
location / {
|
||||
# without a variable, nginx will not start if upstream is down or unavailable
|
||||
resolver 127.0.0.1 valid=30s;
|
||||
set $upstream <%= upstreamUri %>;
|
||||
proxy_ssl_verify off;
|
||||
proxy_pass $upstream;
|
||||
}
|
||||
<% } %>
|
||||
|
||||
<% } else if ( endpoint === 'ip' ) { %>
|
||||
location /notfound.html {
|
||||
root <%= sourceDir %>/dashboard/dist;
|
||||
|
||||
Reference in New Issue
Block a user