File tree Expand file tree Collapse file tree 2 files changed +32
-0
lines changed
Expand file tree Collapse file tree 2 files changed +32
-0
lines changed Original file line number Diff line number Diff line change 55http {
66 include /etc/nginx/mime.types ;
77 default_type application/octet-stream ;
8+ # Allow additional runtime-injected virtual host fragments (created by /startup.sh)
9+ include /etc/nginx/conf.d/*.conf;
810
911 server {
1012 listen 80 ;
Original file line number Diff line number Diff line change 7979
8080echo " ✅ Runtime configuration setup complete!"
8181
82+ # Create an api-proxy config so the container can forward /api requests to the real backend
83+ echo " 📡 Creating API proxy config (/etc/nginx/conf.d/api-proxy.conf)"
84+ cat > /etc/nginx/conf.d/api-proxy.conf << EOF
85+ # Dynamically generated by startup.sh - proxies /api/* to the backend provided by VITE_BACKEND_BASE_URL
86+ proxy_cache_path /tmp/nginx_cache levels=1:2 keys_zone=one:10m max_size=100m inactive=60m;
87+ upstream backend_api {
88+ server ${VITE_BACKEND_BASE_URL} ;
89+ }
90+
91+ server {
92+ listen 127.0.0.1:8080; # internal server used for proxy fragment only
93+
94+ # Proxy any /api requests to the configured backend. This preserves SSE
95+ location /api/ {
96+ proxy_pass ${VITE_BACKEND_BASE_URL} /api/;
97+ proxy_set_header Host $host ;
98+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for ;
99+ proxy_set_header X-Forwarded-Proto $scheme ;
100+ proxy_http_version 1.1;
101+ proxy_set_header Connection '';
102+ proxy_buffering off; # important for SSE
103+ chunked_transfer_encoding off;
104+ proxy_cache_bypass $http_upgrade ;
105+ proxy_read_timeout 3600s;
106+ proxy_send_timeout 3600s;
107+ }
108+ }
109+ EOF
110+ echo " ✅ Wrote /etc/nginx/conf.d/api-proxy.conf"
111+
82112# Start nginx
83113echo " 🌐 Starting nginx..."
84114exec nginx -g " daemon off;"
You can’t perform that action at this time.
0 commit comments