server { listen 8082; server_name _; root /usr/share/nginx/html; # Hashed build assets can be cached forever. location /assets/ { add_header Cache-Control "public, max-age=31536000, immutable"; try_files $uri @strip_prefix; } location / { add_header Cache-Control "no-cache"; try_files $uri @strip_prefix; } # The reverse proxy may forward requests with their path prefix # (e.g. /website/assets/app.js). Drop leading segments until a file # matches; everything else is the single page app. location @strip_prefix { rewrite ^/[^/]+(/.+)$ $1 last; rewrite ^ /index.html last; } }