Reputation: 1
I have a Java web app running on Tomcat and am trying to perform a 302 redirection.
The problem is: original request URL uses HTTPS. I want the redirect URL to use HTTP instead:
response.setHeader('Location', 'http://www.google.com');
For some reason, after checking the redirection pack with Wireshark, the 'Location' header has 'https://www.google.com' instead.
Is there any configuration I can change so Tomcat respects the protocol I set in the header?
Upvotes: 0
Views: 2621
Reputation: 31
Does your web.xml have the security-constraint element something similar to...
<security-constraint>
<web-resource-collection>
<web-resource-name>Secure Web Pages</web-resource-name>
<url-pattern>/*</url-pattern>
</web-resource-collection>
<user-data-constraint>
<transport-guarantee>CONFIDENTIAL</transport-guarantee>
</user-data-constraint>
</security-constraint>
This will force your http requests to be https.
Upvotes: 1