fixing client

This commit is contained in:
stefan
2025-09-15 17:48:57 +02:00
parent f9d492c7e0
commit ea560fc221
30 changed files with 3632 additions and 525 deletions
+36 -57
View File
@@ -1,33 +1,24 @@
# Running as non-root user defined by container user; omit nginx "user" directive
worker_processes auto;
error_log /var/log/nginx/error.log notice;
pid /tmp/nginx.pid;
# ===================================================================
# Nginx-Konfiguration für Meldestelle Web-App
# Static Files + API Proxy zu Gateway
# ===================================================================
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
# Logging
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
access_log /var/log/nginx/access.log main;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 4096;
# Gzip Settings
# Gzip Kompression für bessere Performance
gzip on;
gzip_vary on;
gzip_min_length 10240;
gzip_proxied expired no-cache no-store private auth;
gzip_min_length 1024;
gzip_types
text/plain
text/css
@@ -35,67 +26,55 @@ http {
text/javascript
application/javascript
application/xml+rss
application/json
image/svg+xml;
application/json;
# Security Headers
add_header X-Frame-Options "SAMEORIGIN" always;
add_header X-Content-Type-Options "nosniff" always;
add_header X-XSS-Protection "1; mode=block" always;
add_header Referrer-Policy "no-referrer-when-downgrade" always;
add_header Content-Security-Policy "default-src 'self'; script-src 'self' 'wasm-unsafe-eval'; style-src 'self' 'unsafe-inline'; img-src 'self' data:; font-src 'self';" always;
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
# Upstream für API Gateway
upstream api-gateway {
server api-gateway:8081;
}
# Server-Block für Web-App
server {
listen 4000;
server_name localhost;
root /usr/share/nginx/html;
index index.html;
# Main application route
# Serve static files (Kotlin/JS compiled files)
location / {
try_files $uri $uri/ /index.html;
# Cache static assets
# Cache-Headers für statische Assets
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ {
expires 1y;
add_header Cache-Control "public, immutable";
}
# Source maps - no cache for development
location ~* \.map$ {
expires off;
add_header Cache-Control "no-cache, no-store, must-revalidate";
}
}
# Handle webpack development paths (return 404 gracefully)
location ~* ^/webpack:// {
return 404;
}
# Health check endpoint
location /health {
access_log off;
add_header Content-Type application/json;
return 200 '{"status":"ok","service":"web-app"}\n';
}
# API proxy (if needed for backend communication)
# Proxy API calls zu Gateway
location /api/ {
proxy_pass http://api-gateway:8081/;
proxy_pass http://api-gateway;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
# CORS Headers für API-Calls
add_header Access-Control-Allow-Origin *;
add_header Access-Control-Allow-Methods "GET, POST, PUT, DELETE, OPTIONS";
add_header Access-Control-Allow-Headers "Content-Type, Authorization";
# Handle preflight requests
if ($request_method = 'OPTIONS') {
return 204;
}
}
# Error pages
error_page 404 /index.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
# Health-Check Endpoint
location /health {
access_log off;
return 200 "healthy\n";
add_header Content-Type text/plain;
}
}
}