events {} http { upstream jupiter_k8s { server 66.116.225.226:30822; server 66.116.226.234:30822 backup; } server { listen 8203; location / { # Proxy to Kubernetes NodePort (30822) # NodePorts are bound to 0.0.0.0 and are more reliable to access from host.docker.internal proxy_pass http://jupiter_k8s; # Strip any CORS headers the backend may set itself, so we don't # end up sending duplicate Access-Control-* headers (browsers # reject a response that has more than one value for these). proxy_hide_header 'Access-Control-Allow-Origin'; proxy_hide_header 'Access-Control-Allow-Methods'; proxy_hide_header 'Access-Control-Allow-Headers'; proxy_hide_header 'Access-Control-Max-Age'; 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; # CORS configuration - "The Backend Fix" add_header 'Access-Control-Allow-Origin' '*' always; add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS, PUT, PATCH, DELETE' always; add_header 'Access-Control-Allow-Headers' '*' always; if ($request_method = 'OPTIONS') { add_header 'Access-Control-Allow-Origin' '*' always; add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS, PUT, PATCH, DELETE' always; add_header 'Access-Control-Allow-Headers' '*' always; add_header 'Access-Control-Max-Age' 1728000; add_header 'Content-Type' 'text/plain; charset=utf-8'; add_header 'Content-Length' 0; return 204; } } } }