server { listen 8080; server_name _; root /usr/share/nginx/html; index index.html; # A single-page app: every path that is not a file on disk is the app's own # route, and the app is what decides what it means. Without this, a reload # anywhere but the root is a 404 from nginx. location / { try_files $uri $uri/ /index.html; } # Hashed filenames, so the content at a given name never changes. index.html # is deliberately not in here: it is the file that names the current hashes, # and a cached one pins a deployment to the build it replaced. location /assets/ { expires 1y; add_header Cache-Control "public, immutable"; } # Where this build's source is (https://coffeylabs.org/specs/well-known-source/). # Exact, so a build without one is a 404, not the app. location = /.well-known/source { default_type application/json; add_header Cache-Control "no-cache"; add_header Access-Control-Allow-Origin "*"; try_files $uri =404; } location = /index.html { add_header Cache-Control "no-cache"; } }