Files

56 lines
1.6 KiB
Nginx Configuration File

# Korrith frontend — static SPA + same-origin reverse proxies.
# The frontend calls the API and PocketBase on relative paths, so they must
# be reachable on the same origin as the site:
# /hcgi/api/* -> Express API
# /hcgi/platform/* -> PocketBase (API + admin UI)
server {
listen 80;
server_name korrith.com;
root /usr/share/nginx/html;
index index.html;
client_max_body_size 20m;
gzip on;
gzip_min_length 1024;
gzip_types text/css application/javascript application/json image/svg+xml font/woff2;
# Express API
location /hcgi/api/ {
proxy_pass http://api:3001/;
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;
}
# PocketBase
location /hcgi/platform/ {
proxy_pass http://pocketbase:8090/;
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;
# Server-sent events (realtime subscriptions)
proxy_buffering off;
proxy_cache off;
proxy_read_timeout 3600s;
}
# Hashed build assets — safe to cache aggressively
location /assets/ {
expires 30d;
add_header Cache-Control "public, immutable";
try_files $uri =404;
}
# SPA fallback — client-side routing
location / {
try_files $uri $uri/ /index.html;
}
}