upstream backend_upstream { server backend:8000; keepalive 16; } server { listen 80; server_name _; server_tokens off; etag off; root /usr/share/nginx/html; index index.html; #gzip on; #gzip_comp_level 5; #gzip_min_length 1024; #gzip_types text/plain text/css text/javascript application/javascript application/json application/xml image/svg+xml; add_header X-Content-Type-Options "nosniff" always; add_header X-Frame-Options "SAMEORIGIN" always; add_header Referrer-Policy "strict-origin-when-cross-origin" always; add_header Permissions-Policy "geolocation=(), microphone=(), camera=()" always; proxy_http_version 1.1; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header Connection ""; proxy_buffering off; proxy_read_timeout 60s; proxy_send_timeout 60s; location ^~ /assets/ { expires 7d; add_header Cache-Control "public, max-age=604800, immutable" always; try_files $uri =404; } location = /favicon.ico { expires 7d; add_header Cache-Control "public, max-age=604800" always; try_files $uri =404; } location = /index.html { expires -1; add_header Cache-Control "no-store, no-cache, must-revalidate" always; try_files $uri =404; } location ^~ /api/ { add_header Cache-Control "no-store, no-cache, must-revalidate" always; add_header Pragma "no-cache" always; proxy_pass http://backend_upstream/api/; } location = /docs { add_header Cache-Control "no-store, no-cache, must-revalidate" always; proxy_pass http://backend_upstream/docs; } location = /openapi.json { add_header Cache-Control "no-store, no-cache, must-revalidate" always; proxy_pass http://backend_upstream/openapi.json; } location = /redoc { add_header Cache-Control "no-store, no-cache, must-revalidate" always; proxy_pass http://backend_upstream/redoc; } location / { try_files $uri $uri/ /index.html; } }