Parameterize the previously hardcoded API_BASE so a staging build can point at
the staging API without forking the code:
- env.js.template + /docker-entrypoint.d/30-fleetnow-env.sh render ${API_BASE}
into /env.js on container start (envsubst ships with the nginx image)
- index.html loads /env.js and uses window.FLEETNOW_API_BASE, falling back to
the prod API (https://fleetapi.rahamafresh.com) when unset — so prod/main is
unchanged; staging sets API_BASE=https://fleetapi.fivetitude.com
- nginx: serve /env.js with no-store
Enables the fleetnow.fivetitude.com staging app (Coolify, staging branch).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
38 lines
1.1 KiB
Nginx Configuration File
38 lines
1.1 KiB
Nginx Configuration File
server {
|
|
listen 80;
|
|
listen [::]:80;
|
|
server_name _;
|
|
|
|
root /usr/share/nginx/html;
|
|
index index.html;
|
|
|
|
# Lightweight health endpoint (Docker/Coolify probe + Traefik).
|
|
location = /healthz {
|
|
access_log off;
|
|
add_header Content-Type text/plain;
|
|
return 200 'ok';
|
|
}
|
|
|
|
# Single-page app: always fall back to index.html.
|
|
location / {
|
|
try_files $uri $uri/ /index.html;
|
|
}
|
|
|
|
# index.html must never be cached, so a redeploy is picked up immediately.
|
|
location = /index.html {
|
|
add_header Cache-Control "no-store, no-cache, must-revalidate";
|
|
add_header X-Content-Type-Options "nosniff";
|
|
add_header Referrer-Policy "no-referrer-when-downgrade";
|
|
}
|
|
|
|
# Runtime config (per-environment API base) — must never be cached.
|
|
location = /env.js {
|
|
add_header Cache-Control "no-store, no-cache, must-revalidate";
|
|
default_type application/javascript;
|
|
}
|
|
|
|
gzip on;
|
|
gzip_vary on;
|
|
gzip_min_length 1024;
|
|
gzip_types text/plain text/css application/javascript application/json image/svg+xml;
|
|
}
|