super-productivity/nginx/default.conf.template
Johannes Millan 2fa804c07a refactor(e2e): migrate to production Dockerfile for E2E tests
Complete E2E Docker migration (Steps 1-3):

1. Add SPA routing support in nginx (try_files directive)
2. Make APP_PORT configurable via environment variable
3. Migrate docker-compose.e2e.yaml from dev server to production build

Changes:
- docker-compose.e2e.yaml: Use production Dockerfile instead of dev server
  - Remove volume mounts (self-contained production build)
  - Add UNSPLASH build args
  - Add WEBDAV_BACKEND environment variable
  - Reduce healthcheck start_period from 120s to 30s (nginx is faster)
- nginx/default.conf.template: Add try_files for SPA routing, use APP_PORT
- docker-entrypoint.sh: Export APP_PORT with default value

Benefits:
- Production build provides more realistic test environment
- Faster startup (30s vs 120s)
- No dependency on local node_modules
- Matches production deployment more closely
2026-01-21 14:30:24 +01:00

37 lines
1,019 B
Text

# Load environment variables
map "" $webdav_backend {
default "$WEBDAV_BACKEND";
}
server {
listen ${APP_PORT};
server_name localhost;
# serve super-productivity as static files at the path /
location / {
root /usr/share/nginx/html;
index index.html index.htm;
try_files $uri $uri/ /index.html;
}
# forward requests starting with "/webdav/" to $WEBDAV_BACKEND
# note: the prefix "/webdav" is removed during forwarding
location = /webdav {
return 302 /webdav/;
}
location /webdav/ {
if ($webdav_backend = "") {
return 404;
}
resolver 127.0.0.11; # resolve webdav_backend by docker internal DNS
rewrite ^/webdav/(.*)$ /$1 break; # remove the `/webdav/` prefix
proxy_pass $webdav_backend;
}
# redirect server error pages to the static page /50x.html
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}