36 lines
1.1 KiB
Nginx Configuration File
36 lines
1.1 KiB
Nginx Configuration File
server {
|
|
listen 80;
|
|
server_name localhost;
|
|
|
|
# Serve static frontend files
|
|
location / {
|
|
root /usr/share/nginx/html;
|
|
index index.html;
|
|
try_files $uri $uri/ /index.html;
|
|
}
|
|
|
|
# Reverse proxy API requests to the Node.js backend Service
|
|
# In Kubernetes, the Service name "taskmanager-api" resolves via
|
|
# cluster DNS to the API pods on port 3000.
|
|
location /api/ {
|
|
proxy_pass http://taskmanager-api:3000/api/;
|
|
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;
|
|
proxy_connect_timeout 10s;
|
|
proxy_read_timeout 30s;
|
|
}
|
|
|
|
# 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;
|
|
|
|
# Gzip compression
|
|
gzip on;
|
|
gzip_types text/plain text/css application/json application/javascript text/xml;
|
|
gzip_min_length 256;
|
|
}
|