MyKindlebox/mykindlebox/client/nginx.conf

39 lines
1.1 KiB
Nginx Configuration File

server {
listen 80;
server_name _;
root /usr/share/nginx/html;
index index.html;
# Rabbit photos can be a few MB; the nginx default (1m) would reject them.
client_max_body_size 10m;
# API and uploaded files are reverse-proxied to the Node server so the whole
# app stays same-origin (session cookies, relative fetch URLs all just work).
# "server" is the service name from docker-compose.yml.
location /api/ {
proxy_pass http://server:3001;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location /uploads/ {
proxy_pass http://server:3001;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
# The service worker must never be served stale, or clients can get pinned to
# an old shell that points at a renamed bundle.
location = /sw.js {
add_header Cache-Control "no-cache";
}
# SPA fallback: unknown paths are client-side routes, so serve index.html.
location / {
try_files $uri $uri/ /index.html;
}
}