proxyAuth: add a hack to invalidate cache

when user goes to /logout and then goes to /, the browser will
serve up the cached / based on cache-control. This might make the
user believe they are not logged out.

fixes #753
This commit is contained in:
Girish Ramakrishnan
2020-12-19 15:19:01 -08:00
parent 3ccd527c8b
commit 64a4b712cc

View File

@@ -92,6 +92,14 @@ server {
add_header Referrer-Policy "no-referrer-when-downgrade";
proxy_hide_header Referrer-Policy;
# workaround caching issue after /logout. if max-age is set, browser uses cache and user thinks they have not logged out
# have to keep all the add_header here to avoid repeating all add_header in location block
<% if (proxyAuth.enabled) { %>
proxy_hide_header Cache-Control;
add_header Cache-Control no-cache;
add_header Set-Cookie $auth_cookie;
<% } %>
# gzip responses that are > 50k and not images
gzip on;
gzip_min_length 50k;
@@ -250,7 +258,6 @@ server {
location "<%= proxyAuth.path %>" {
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://<%= ip %>:<%= port %>;