56 lines
1.8 KiB
Plaintext
56 lines
1.8 KiB
Plaintext
server {
|
||
listen 80;
|
||
server_name 1bis.hocks.eu localhost _;
|
||
|
||
root /usr/share/nginx/html;
|
||
index index.html;
|
||
|
||
gzip on;
|
||
gzip_types text/css application/javascript image/svg+xml application/json;
|
||
gzip_min_length 1024;
|
||
|
||
# Docker-eigener DNS: Upstream-Namen bei jeder Anfrage neu auflösen.
|
||
# Ohne das puffert nginx die Container-IP vom Start – nach einem Recreate
|
||
# der Mail-API (neue IP) liefert jede Anfrage 502, bis nginx neu startet.
|
||
resolver 127.0.0.11 valid=10s;
|
||
|
||
# HTML nie cachen (Assets sind hash-benannt → ein Reload genügt)
|
||
location = /index.html {
|
||
add_header Cache-Control "no-cache" always;
|
||
}
|
||
|
||
# Cache für gehashte Build-Assets
|
||
location ^~ /assets/ {
|
||
expires 30d;
|
||
add_header Cache-Control "public, immutable";
|
||
}
|
||
|
||
# Statische Dateien im Root (Favicons – nicht hash-benannt, kurz cachen)
|
||
location ~* \.(png|jpg|jpeg|webp|ico|svg|woff2?)$ {
|
||
expires 1d;
|
||
add_header Cache-Control "public";
|
||
}
|
||
|
||
# Mail-API (Container onebis8-mail-api im selben Docker-Netz npm_default).
|
||
# Das Token kommt aus app.env (envsubst beim Container-Start) und liegt
|
||
# NIE im Browser – der Endpunkt ist nur vom Server erreichbar.
|
||
location = /api/mail/send {
|
||
limit_except POST { deny all; }
|
||
set $mail_api http://onebis8-mail-api:8080;
|
||
proxy_pass $mail_api/send;
|
||
proxy_set_header Host $host;
|
||
proxy_set_header X-Api-Token "${MAIL_API_TOKEN}";
|
||
proxy_set_header X-Request-Source onebis8-nginx;
|
||
client_max_body_size 64k;
|
||
proxy_read_timeout 15s;
|
||
}
|
||
|
||
# SPA-Fallback
|
||
location / {
|
||
try_files $uri $uri/ /index.html;
|
||
}
|
||
|
||
add_header X-Content-Type-Options "nosniff" always;
|
||
add_header X-Frame-Options "DENY" always;
|
||
}
|