# nginx config for the static mitsu-chaiyaporn mirror.
# Serves directory index.html (e.g. /catalog/item/X/ -> .../index.html).
# Also handles the home "/" -> /index.html.

server {
    listen 80;
    server_name _;

    root /usr/share/nginx/html;
    index index.html;

    # Drop the Drupal "X-Drupal-Cache"-style dynamic headers; force no-cache on HTML
    # so content refreshes on redeploy, but long-cache immutable assets.
    location / {
        try_files $uri $uri/ /index.html;
        add_header Cache-Control "no-cache";
    }

    # Cache static assets aggressively (hashed filenames -> safe to cache long)
    location ~* \.(css|js|jpe?g|png|gif|webp|svg|ico|woff2?|ttf)$ {
        expires 30d;
        add_header Cache-Control "public, max-age=2592000, immutable";
        try_files $uri =404;
    }

    gzip on;
    gzip_types text/css application/javascript image/svg+xml application/json;
}
