I'm hoping someone can help me with this. I'm looking to proxy pass something like this:
http://storage.domainname.com:port
to this:
http://192.168.12.10:port
My problem is that the port is dynamic, and it's not feasible for me to write dozens of location
blocks for it.
This is my conf (I'm using port 61788 for testing):
server {
listen 61788;
server_name storage.*;
client_max_body_size 0;
location / {
include /config/nginx/proxy.conf;
set $upstream_app 192.168.12.10;
set $upstream_proto http;
proxy_pass $upstream_proto://$upstream_app:61788;
}
}
I don't think using location regex is applicable here, as the port is specified in the host. I've tried using $remote_host
in proxy_pass
, but that gave me a bad gateway error. Does anyone have any ideas?
$server_port
.