proxy_pass & getServerPort problems

Jiang Web lists at
Thu Feb 13 01:00:48 UTC 2014

Francis Daly wrote in post #1136476:
> On Wed, Feb 12, 2014 at 08:51:13AM +0100, Jiang Web wrote:
> Hi there,
>> location /NetWeb/ {
>> proxy_pass http://w3new_cls/NetWeb/;
>> proxy_redirect off;
>> proxy_set_header Host $host:80;
>> when I access the URL: and the application
>> use the <%request.getServerPort%> to get the server port is 9090, Not
>> the port 80.
>> But I want to get the port is, How can I to resovle the
>> problems.
> getServerPort is not an nginx thing, and nginx probably cannot affect
> what it reports.
> What do you do with the result of getServerPort?
> Would using something like getHeader("Host") be adequate instead?
>   f
> --
> Francis Daly        francis at

When I access the application the 
application will 302(relocation) to to make the user login 
the system(the is our sso system). The 
xxxxxxx in the URI is the last request url(we think is, and we get the last request url(in java 
program) using <%request.getRequestURL%>, but the result is 
xxxxxxxx= not the We test it and found that:
<%request.getServerName%> is
<%request.getServerPort%> is 9090
<%request.getURI%> is /NetWeb
so we think that when we use the nginx as a reverse proxy to proxy the 
request, the request.getServerPort is 9090 not 80. If we use the apache 
as a reverse proxy to proxy the request adding parameter 
"ProxyPreserveHost on",  the request.getServerPort is 80.

Thanks for help and reply.

Posted via

More information about the nginx mailing list