chris c130f9bcdf nginx: redirect /color-picker/* to /color/*
Browsers with cached pages from the old /color-picker/ path resolve
relative image URLs against that base, causing 404s after the rename.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-15 14:32:25 -04:00

62 lines
3.0 KiB
Nginx Configuration File

events {}
http {
# ── Compression ──────────────────────────────────────────────────────────────
gzip on;
gzip_types text/plain text/css text/javascript application/javascript application/json image/svg+xml;
gzip_min_length 1024;
gzip_vary on;
# ── Upstreams ─────────────────────────────────────────────────────────────────
upstream estore {
server estore:3000;
}
upstream main_site {
server main-site:3050;
}
server {
listen 80;
server_name _;
client_max_body_size 20m;
# ── Security headers ─────────────────────────────────────────────────────
add_header X-Frame-Options "SAMEORIGIN" always;
add_header X-Content-Type-Options "nosniff" always;
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
# ── Redirect old color-picker URL ────────────────────────────────────────
location ~ ^/color-picker(/.*)?$ { return 301 /color$1; }
# ── Redirects for legal pages (moved from main site into estore) ─────────
location = /privacy { return 301 /shop/privacy; }
location = /privacy/ { return 301 /shop/privacy; }
location = /terms { return 301 /shop/terms; }
location = /terms/ { return 301 /shop/terms; }
location = /refund { return 301 /shop/refund; }
location = /refund/ { return 301 /shop/refund; }
# ── eStore: /shop and everything under it ────────────────────────────────
location ^~ /shop {
proxy_pass http://estore;
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;
}
# ── Main site: everything else ───────────────────────────────────────────
location / {
proxy_pass http://main_site;
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;
}
}
}