Move gzipping to nginx

This means less time is spent in gunicorn, letting the workers process other requests sooner.
This commit is contained in:
Jake Howard 2024-05-04 23:19:43 +01:00
parent 514e609973
commit 7fcbbad885
Signed by: jake
GPG key ID: 57AFB45680EDD477
2 changed files with 4 additions and 1 deletions

View file

@ -14,6 +14,9 @@ server {
gzip_static on; gzip_static on;
gzip on;
gzip_vary on;
set_real_ip_from 0.0.0.0/0; set_real_ip_from 0.0.0.0/0;
real_ip_header X-Forwarded-For; real_ip_header X-Forwarded-For;
@ -39,6 +42,7 @@ server {
location / { location / {
proxy_pass http://localhost:8080; proxy_pass http://localhost:8080;
gzip_types *;
} }
location /static { location /static {

View file

@ -94,7 +94,6 @@ INSTALLED_APPS = [
] ]
MIDDLEWARE = [ MIDDLEWARE = [
"django.middleware.gzip.GZipMiddleware",
"django.middleware.security.SecurityMiddleware", "django.middleware.security.SecurityMiddleware",
"django.middleware.clickjacking.XFrameOptionsMiddleware", "django.middleware.clickjacking.XFrameOptionsMiddleware",
"corsheaders.middleware.CorsMiddleware", "corsheaders.middleware.CorsMiddleware",