Welcome! Log In Create A New Profile

Advanced

Nginx rewrites URL

P lva
January 18, 2018 01:04PM
Hello Everyone,

I'm trying to get nginx server configured as a reverse proxy serving
requests to few application servers upstream.

Server {
server_name app1.company.domain.com;
listen 80;

location / {
proxy_pass http://appserver1:app1port/;
proxy_pass_request_body on;
proxy_intercept_errors on;
error_page 301 302 307 = @handle_redirect;
}

location @handle_redirect {
set $saved_redirect_location '$upstream_http_location';
proxy_pass $saved_redirect_location;
}
I'm having two challenges with this.

1) This doesn't work with the firewalls. I can get to it only if I open
appserver1 to accept everyone on that app1port. I tried replacing the
headers but none of them work.

2) This configuration works when I turn off the firewall, but the address
in the address bar gets rewritten to http://appserver1:app1port which is a
a dealbreaker as we definitely don't want to have the upstream server
appear in the address bar.

Also these servers (nginx server and the upstream app server) aren't
connected to the same DNS as the client. So neither of these servers can
resolve app1.company.domain.com
I'm not sure where the problem lies, and would really appreciate any
pointers.

Thanks
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Nginx rewrites URL

P lva January 18, 2018 01:04PM

Re: Nginx rewrites URL

Francis Daly January 20, 2018 09:18AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 338
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready