38 lines
1.4 KiB
Plaintext
38 lines
1.4 KiB
Plaintext
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;
|
|
|
|
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;
|
|
}
|
|
}
|
|
}
|
|
}
|