85 lines
2.4 KiB
Plaintext
85 lines
2.4 KiB
Plaintext
upstream honey_backend {
|
|
# Primary backend (port 8080)
|
|
server 127.0.0.1:8080 max_fails=3 fail_timeout=30s;
|
|
# Standby backend (port 8082) - used during rolling updates
|
|
# Uncomment the line below to switch traffic to new backend
|
|
# server 127.0.0.1:8082 max_fails=3 fail_timeout=30s backup;
|
|
|
|
# Health check configuration
|
|
keepalive 32;
|
|
}
|
|
|
|
server {
|
|
listen 80;
|
|
server_name _;
|
|
|
|
# Increase body size limit for API requests
|
|
client_max_body_size 10M;
|
|
|
|
# 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;
|
|
|
|
# API endpoints
|
|
location /api/ {
|
|
proxy_pass http://honey_backend;
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
proxy_set_header Connection 'upgrade';
|
|
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;
|
|
proxy_cache_bypass $http_upgrade;
|
|
|
|
# Timeouts
|
|
proxy_connect_timeout 60s;
|
|
proxy_send_timeout 60s;
|
|
proxy_read_timeout 60s;
|
|
}
|
|
|
|
# Actuator endpoints (for health checks)
|
|
location /actuator/ {
|
|
proxy_pass http://honey_backend;
|
|
proxy_http_version 1.1;
|
|
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;
|
|
}
|
|
|
|
# Ping endpoint
|
|
location /ping {
|
|
proxy_pass http://honey_backend;
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Host $host;
|
|
}
|
|
|
|
# Frontend (if serving static files)
|
|
location / {
|
|
root /usr/share/nginx/html;
|
|
try_files $uri $uri/ /index.html;
|
|
index index.html;
|
|
}
|
|
}
|
|
|
|
# HTTPS configuration (uncomment and configure when SSL certificates are available)
|
|
# server {
|
|
# listen 443 ssl http2;
|
|
# server_name your-domain.com;
|
|
#
|
|
# ssl_certificate /etc/nginx/ssl/cert.pem;
|
|
# ssl_certificate_key /etc/nginx/ssl/key.pem;
|
|
#
|
|
# # SSL configuration
|
|
# ssl_protocols TLSv1.2 TLSv1.3;
|
|
# ssl_ciphers HIGH:!aNULL:!MD5;
|
|
# ssl_prefer_server_ciphers on;
|
|
#
|
|
# # Same location blocks as HTTP server
|
|
# # ...
|
|
# }
|
|
|
|
|