- Multi-stage Dockerfile: Node builds static assets, nginx serves them - nginx proxies /api/* to football-data.org and injects X-Auth-Token server-side via FOOTBALL_API_KEY env var (key never in browser bundle) - docker-compose.yml exposes the app on port 3000 - Extract apiFetch() helper: sends key in dev (Vite proxy), skips in prod - .env.example updated with both dev and production key vars Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
21 lines
652 B
Plaintext
21 lines
652 B
Plaintext
server {
|
|
listen 80;
|
|
root /usr/share/nginx/html;
|
|
index index.html;
|
|
|
|
# Proxy /api/* → football-data.org, injecting the API key server-side
|
|
location /api/ {
|
|
proxy_pass https://api.football-data.org/v4/;
|
|
proxy_set_header Host api.football-data.org;
|
|
proxy_set_header X-Auth-Token ${FOOTBALL_API_KEY};
|
|
proxy_ssl_server_name on;
|
|
proxy_hide_header Access-Control-Allow-Origin;
|
|
add_header Access-Control-Allow-Origin $http_origin always;
|
|
}
|
|
|
|
# SPA fallback: all unmatched routes serve index.html
|
|
location / {
|
|
try_files $uri $uri/ /index.html;
|
|
}
|
|
}
|