'How to do a redirect behind Nginx
My Tomcat server sits behind an Nginx reverse proxy.
I configured RemoteIpValve in Tomcat to replace hostname, port and scheme. Tomcat works on localhost:8080.
Tomcat valve (server.xml)
<Valve className="org.apache.catalina.valves.RemoteIpValve"
remoteIpHeader="x-forwarded-for"
protocolHeader="x-forwarded-proto"
proxiesHeader="x-forwarded-by" />
When i redirect from https://example.com/pages/MyForm.jsp to https://example.com/pages/MyForm.jsp?message=Something, it works correctly,
but when i try to redirect from https://example.com/pages/MyForm.jsp to https://example.com/pages/AnotherPage.jsp?message=Something the
site can't be reached.
Unlike the first example request, the second one displays port 8080 in the location of Response Headers.
location: https://example.com:8080/pages/AnotherPage.jsp?message=Something`
Request Method: GET
Is there any configuration that should be done in Nginx or Tomcat? How can i solve this problem?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
