Files
metabuilder/frontends/pastebin/tests/e2e/nginx.e2e.conf
2026-03-09 22:30:41 +00:00

97 lines
2.8 KiB
Plaintext

user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 256;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
client_max_body_size 50M;
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
server {
listen 80;
server_name _;
server_tokens off;
# Docker DNS resolver
resolver 127.0.0.11 valid=10s ipv6=off;
# Health check
location /health {
access_log off;
return 200 '{"status":"healthy"}';
add_header Content-Type application/json;
}
# Pastebin Next.js frontend
location /pastebin {
set $upstream_pastebin pastebin;
proxy_pass http://$upstream_pastebin:3000;
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_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
}
# Pastebin Flask Backend API — strips /pastebin-api/ prefix
location /pastebin-api/ {
set $upstream_pastebin_backend pastebin-backend;
rewrite ^/pastebin-api/(.*)$ /$1 break;
proxy_pass http://$upstream_pastebin_backend:5000;
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;
}
# DBAL API via /api/dbal/ — strips prefix
location /api/dbal/ {
set $upstream_dbal dbal;
rewrite ^/api/dbal/(.*)$ /$1 break;
proxy_pass http://$upstream_dbal:8080;
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;
}
# DBAL API direct (/api/health, /api/{tenant}/{pkg}/{entity})
location /api/ {
set $upstream_dbal dbal;
rewrite ^/api/(.*)$ /$1 break;
proxy_pass http://$upstream_dbal:8080;
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;
}
# Next.js internal routes (HMR, static assets)
location /_next/ {
set $upstream_pastebin pastebin;
proxy_pass http://$upstream_pastebin:3000;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
}
}
}