I want to send a request between two clusters using nginx on a separate server
there is an nginx server to route via upstream to two identical backends in two different clusters
, let’s say the validator application is deployed in two clusters and has different ingress addresses
validator.amd.com
validator.bm.com
I set it up on nginx like this
server {
listen 80;
server_name test.test.com;
location / {
return 301 https://$host$request_uri;
}
}
upstream valid{
server validator.amd.com:80;
server validator.bm.com:80;
}
server {
listen 443 ssl;
server_name test.test.com;
ssl_certificate test.test.com.crt;
ssl_certificate_key test.test.com.key;
location / {
return 204;
}
location /keepalive {
return 200;
}
location /api/valid {
proxy_set_header Content-Type application/json;
proxy_pass http://valid/api/validators;
}
}
it doesn’t work at all through the upstream
, but if I proxy
location /api/valid {
proxy_set_header Content-Type application/json;
proxy_pass http://validator.amd.com/api/validators;
}
then everything is OK, similarly, if you put another domain
, I do not understand what the catch might be and why everything works directly, and if there is no upstream, please tell me?
I also tried adding headers
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
Content-Type application/json;