Answer the question
In order to leave comments, you need to log in
How to get the server name from the upstream section from a variable in Nginx?
Hello!
There is a project deployed on two OpenShift clusters.
I am setting up an Nginx balancer between clusters.
Openshift routes work in Passthrought SSL termination mode.
In order for the service to open normally, hostname must be passed to NGINX proxy_ssl_name.
I'm trying something like this NGINX configuration:
upstream backend {
server.com.one
server.com.two max_fails ...
}
server {
...
proxy_ssl_name $proxy_host;
proxy_set_header Host $proxy_host;
proxy_pass https://backend;
}
Answer the question
In order to leave comments, you need to log in
You can add an intermediate server block for each upstream and proxy through it.
More or less like this:
upstream backend {
127.127.0.1:2000;
127.127.0.2:2000 max_fails ...;
}
server {
proxy_pass https://backend;
}
server {
listen 127.127.0.1:2000;
location / {
proxy_pass https://server.com.one;
}
}
server {
listen 127.127.0.2:2000;
location / {
proxy_pass https://server.com.two;
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question