D
D
Dmitry2016-10-27 00:38:14
Nginx
Dmitry, 2016-10-27 00:38:14

Why doesn't nginx process the proxy_pass variable?

Hey All!
There is nginx configured in such a way - to accept and process domains with subdomains. If a request for a subdomain comes in, then a variable is generated in the config. The challenge is to do
...

location /search/ }
proxy_pass http://$subdomain:9200;
}

without a variable - everything works fine, I set a variable - it does not plow. The nonsense is that $subdomain contains a 100% subdomain name, only proxying does not work, since the paths to directories with scripts and scripts work with this variable, the problem is only in proxying and where to proxy the same service is running, but when working with the variable, I I get a 502 error from nginx, I change it to a name - the error goes away and everything works.
I need proxying to work for any subdomain - since there can be many of them, services where to proxy the same.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Erelecano Oioraen, 2016-10-27
@Erelecano

How exactly do you generate a variable? Where does it come from?
Show me that piece.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question