69 lines
2.0 KiB
Plaintext
69 lines
2.0 KiB
Plaintext
events {
|
|
worker_connections 1024;
|
|
}
|
|
|
|
http {
|
|
include /etc/nginx/mime.types;
|
|
default_type application/octet-stream;
|
|
sendfile on;
|
|
keepalive_timeout 65;
|
|
|
|
# Upstream for mini-qr service
|
|
upstream mini-qr-backend {
|
|
server mini-qr:8080;
|
|
}
|
|
|
|
server {
|
|
listen 80;
|
|
server_name localhost;
|
|
|
|
# Root path - redirect to mini-qr
|
|
location = / {
|
|
return 301 /mini-qr/;
|
|
}
|
|
|
|
# Mini QR application with subpath
|
|
location /mini-qr/ {
|
|
# Remove /mini-qr prefix before forwarding to backend
|
|
rewrite ^/mini-qr/(.*) /$1 break;
|
|
|
|
proxy_pass http://mini-qr-backend;
|
|
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_set_header X-Forwarded-Host $host;
|
|
proxy_set_header X-Forwarded-Port $server_port;
|
|
|
|
# Handle assets specifically
|
|
location ~* ^/mini-qr/assets/ {
|
|
rewrite ^/mini-qr/(.*) /$1 break;
|
|
proxy_pass http://mini-qr-backend;
|
|
expires 1y;
|
|
add_header Cache-Control "public, immutable";
|
|
}
|
|
|
|
# Handle static files
|
|
location ~* ^/mini-qr/.*\.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ {
|
|
rewrite ^/mini-qr/(.*) /$1 break;
|
|
proxy_pass http://mini-qr-backend;
|
|
expires 1y;
|
|
add_header Cache-Control "public, immutable";
|
|
}
|
|
}
|
|
|
|
# Health check endpoint
|
|
location /health {
|
|
access_log off;
|
|
return 200 "healthy\n";
|
|
add_header Content-Type text/plain;
|
|
}
|
|
|
|
# Error pages
|
|
error_page 500 502 503 504 /50x.html;
|
|
location = /50x.html {
|
|
root /usr/share/nginx/html;
|
|
}
|
|
}
|
|
}
|