worker_processes 1; events { worker_connections 1024; } http { include /etc/nginx/mime.types; default_type application/octet-stream; types { application/manifest+json webmanifest; } sendfile off; keepalive_timeout 65; server { listen 80; server_name _; root /opt/app/build; # all assets are either static or contain hash in filename, cache forever location ^~ /assets/ { add_header Cache-Control "public, max-age=31536000, s-maxage=31536000, immutable"; try_files $uri =404; } # all workbox scripts are compiled with hash in filename, cache forever location ^~ /workbox- { add_header Cache-Control "public, max-age=31536000, s-maxage=31536000, immutable"; try_files $uri =404; } location / { autoindex off; expires off; add_header Cache-Control "public, max-age=0, s-maxage=0, must-revalidate" always; try_files $uri /index.html =404; } location /backend { expires off; add_header Cache-Control "public, max-age=0, s-maxage=0, must-revalidate" always; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $remote_addr; proxy_set_header Host $host; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_redirect off; rewrite ^/backend/?(.*) /$1 break; proxy_pass http://backend:8080; } } }