diff --git a/bookwyrm/nginx.conf b/bookwyrm/nginx.conf index 201325f..d430ab1 100644 --- a/bookwyrm/nginx.conf +++ b/bookwyrm/nginx.conf @@ -20,16 +20,6 @@ server { client_body_buffer_size 10M; client_max_body_size 10M; - set $skip_cache 0; - if ($request_method = POST) { - set $skip_cache 1; - } - - if ($http_cookie ~* "session") { - set $skip_cache 1; - } - - location ~ ^/(login[^-/]|password-reset|resend-link|2fa-check) { limit_req zone=loginlimit; @@ -50,12 +40,13 @@ server { location / { proxy_cache mycache; add_header X-Cache-Status $upstream_cache_status; - proxy_ignore_headers Cache-Control Set-Cookie; + proxy_ignore_headers Cache-Control Set-Cookie Expires; #proxy_ignore_headers Cache-Control; - # logged in sessions and other reasons to bypass the cache - proxy_no_cache $skip_cache; - proxy_cache_bypass $skip_cache; + # logged in sessions and PUT bypass the cache + proxy_cache_methods GET HEAD; + proxy_no_cache $cookie_session; + proxy_cache_bypass $cookie_session; proxy_cache_valid any 1m; @@ -67,12 +58,12 @@ server { location /images/ { alias /bookwyrm/app/images/; - access_log off; + #access_log off; } location /static/ { alias /bookwyrm/app/static/; - access_log off; + #access_log off; } include /etc/nginx/includes/ssl.conf;