A custom entrypoint generates /etc/nginx/.htpasswd at container startup from AUTH_USER and AUTH_PASSWORD env vars (via openssl). No credentials are baked into the image. Pass AUTH_USER and AUTH_PASSWORD in docker-compose. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
24 lines
731 B
Plaintext
24 lines
731 B
Plaintext
server {
|
|
listen 80;
|
|
root /usr/share/nginx/html;
|
|
index index.html;
|
|
|
|
auth_basic "Football App";
|
|
auth_basic_user_file /etc/nginx/.htpasswd;
|
|
|
|
# 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;
|
|
}
|
|
}
|