From 3a5a73f6a664c493e6256cc7086e8b9b4cb343ab Mon Sep 17 00:00:00 2001 From: Bensuperpc Date: Thu, 1 Dec 2022 14:42:01 +0100 Subject: [PATCH] Update website and disable nginx cache for now --- bensuperpc_website | 2 +- nginx-conf/flask_wsgi.conf | 41 +++++++++++++++++++++++++++++--------- 2 files changed, 33 insertions(+), 10 deletions(-) diff --git a/bensuperpc_website b/bensuperpc_website index a83b09c..8e0e433 160000 --- a/bensuperpc_website +++ b/bensuperpc_website @@ -1 +1 @@ -Subproject commit a83b09c8143dc681be72385e7948288c6e005941 +Subproject commit 8e0e433bdf1969282d89b3bb9f14a722d1bc4acf diff --git a/nginx-conf/flask_wsgi.conf b/nginx-conf/flask_wsgi.conf index 76953f3..238fccc 100644 --- a/nginx-conf/flask_wsgi.conf +++ b/nginx-conf/flask_wsgi.conf @@ -1,4 +1,4 @@ -include /etc/nginx/conf.d/sub/cache-uwsgi.conf; +#include /etc/nginx/conf.d/sub/cache-uwsgi.conf; upstream flask_server { # ip_hash; @@ -43,6 +43,24 @@ server { include /etc/nginx/conf.d/sub/options-ssl-nginx.conf; + #set $skip_cache 1; + #set $skip_reason "Disabled for now"; + + #if ($request_method = POST) { + # set $skip_cache 1; + # set $skip_reason "POST request"; + #} + + #if ($request_uri ~* "(/admin/|/logout|/login)") { + # set $skip_cache 1; + # set $skip_reason "request_uri"; + #} + + #if ($http_cookie ~* "remember_token") { + # set $skip_cache 1; + # set $skip_reason "${skip_reason}-http_cookie"; + #} + location / { try_files $uri @flask_app; } location @flask_app { @@ -51,20 +69,25 @@ server { uwsgi_buffering on; uwsgi_buffers 8 16k; + + #uwsgi_cache_bypass $skip_cache; + #uwsgi_no_cache $skip_cache; - uwsgi_cache UWSGI; - uwsgi_cache_valid 200 302 10m; - uwsgi_cache_valid 301 1h; - uwsgi_cache_valid any 1m; - uwsgi_cache_lock on; + #uwsgi_cache_valid 200 302 10m; + #uwsgi_cache_valid 301 1h; + #uwsgi_cache_valid any 1m; + #uwsgi_cache_lock on; #uwsgi_ignore_headers Vary; #uwsgi_hide_header Vary; - uwsgi_ignore_headers Expires Cache-Control Set-Cookie Vary; - uwsgi_hide_header Vary; + #uwsgi_ignore_headers Expires Cache-Control Set-Cookie Vary; + #uwsgi_hide_header Vary; - add_header X-cache $upstream_cache_status; + #add_header X-cache $upstream_cache_status; + #add_header X-cache-reason $skip_reason; + + #uwsgi_cache UWSGI; } # Don't write to accesslog for these files