- deploy.sh now copies manifest.json, sw.js, system-prompt.txt - deploy.sh sets proper ownership/permissions on /var/www/the-door - nginx.conf adds CORS headers for alexanderwhitestone.com origins - nginx.conf handles OPTIONS preflight requests - deploy.sh injects CORS map into nginx.conf - Add BACKEND_SETUP.md with Hermes gateway config instructions Addresses the-door#3 (frontend completeness) and the-door#4 (backend/API wiring)
72 lines
2.5 KiB
Nginx Configuration File
72 lines
2.5 KiB
Nginx Configuration File
# The Door — nginx config for alexanderwhitestone.com
|
|
# Place at /etc/nginx/sites-available/the-door
|
|
|
|
server {
|
|
listen 80;
|
|
server_name alexanderwhitestone.com www.alexanderwhitestone.com;
|
|
return 301 https://$server_name$request_uri;
|
|
}
|
|
|
|
server {
|
|
listen 443 ssl http2;
|
|
server_name alexanderwhitestone.com www.alexanderwhitestone.com;
|
|
|
|
ssl_certificate /etc/letsencrypt/live/alexanderwhitestone.com/fullchain.pem;
|
|
ssl_certificate_key /etc/letsencrypt/live/alexanderwhitestone.com/privkey.pem;
|
|
|
|
root /var/www/the-door;
|
|
index index.html;
|
|
|
|
# Static files
|
|
location / {
|
|
try_files $uri $uri/ /index.html;
|
|
add_header X-Content-Type-Options nosniff;
|
|
add_header X-Frame-Options DENY;
|
|
add_header X-XSS-Protection "1; mode=block";
|
|
add_header Referrer-Policy "no-referrer";
|
|
add_header Content-Security-Policy "default-src 'self'; script-src 'unsafe-inline'; style-src 'unsafe-inline'; connect-src 'self'";
|
|
}
|
|
|
|
# API proxy to Hermes
|
|
location /api/ {
|
|
proxy_pass http://127.0.0.1:8644/;
|
|
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;
|
|
|
|
# CORS — allow alexanderwhitestone.com origins
|
|
add_header Access-Control-Allow-Origin $cors_origin always;
|
|
add_header Access-Control-Allow-Methods "GET, POST, OPTIONS" always;
|
|
add_header Access-Control-Allow-Headers "Authorization, Content-Type" always;
|
|
|
|
# Handle OPTIONS preflight
|
|
if ($request_method = OPTIONS) {
|
|
add_header Access-Control-Allow-Origin $cors_origin always;
|
|
add_header Access-Control-Allow-Methods "GET, POST, OPTIONS" always;
|
|
add_header Access-Control-Allow-Headers "Authorization, Content-Type" always;
|
|
add_header Access-Control-Max-Age 86400 always;
|
|
return 204;
|
|
}
|
|
|
|
# SSE streaming support
|
|
proxy_set_header Connection '';
|
|
proxy_buffering off;
|
|
proxy_cache off;
|
|
chunked_transfer_encoding on;
|
|
proxy_read_timeout 300s;
|
|
|
|
# Rate limiting
|
|
limit_req zone=api burst=5 nodelay;
|
|
}
|
|
|
|
# Health check
|
|
location /health {
|
|
proxy_pass http://127.0.0.1:8644/health;
|
|
}
|
|
|
|
# Rate limit zone (define in http block of nginx.conf)
|
|
# limit_req_zone $binary_remote_addr zone=api:10m rate=10r/m;
|
|
}
|