Quantcast
Channel: Nginx Forum - How to...
Viewing all articles
Browse latest Browse all 4759

reverse proxy with TLS termination and DNS lookup

$
0
0
hi all..

I am trying to configure a reverse proxy which redirects a URL of the form:

https://mydomain.com/myapp/abcd/...

to:

http://myapp:5100/abcd/...

with DNS resolution of "myapp" to an IP address at runtime.

My current configuration file is:

server{
listen 80 default_server;
server_name mydomain.com;
return 301 https://www.mydomain.com$request_uri;
}

server{
listen 443 ssl default_server;
server_name mydomain.com;
<ssl setup.. works ok>;

resolver 123.4.5.6 valid=60s; // DNS name server.. 'nslookup myapp' does work
set app_upstream http://myapp:5100;
location /myapp/ {
rewrite ^/myapp/(.*) /$1 break;
proxy_pass $app_upstream;
}
}

When i try:

https://mydomain.com/myapp/

it resolves to:

http://myapp/

but the log shows that the port isn't appended. I would prefer it if the caller didn't have to know the port. I could iterate, but don't have enough experience to say whether the overall approach is consistent with Nginx best practice and i need to proxy servers other than myapp so any feedback would be appreciated.

thanks!

Viewing all articles
Browse latest Browse all 4759

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>