http connector redirecting to 8443 even though the redirectPort on the connector is changed in JBoss EAP 5.x
Issue
- We are trying to force http requests to our web application to redirect to https. We are running http on port 80 and
httpson port443and have theredirectPortset to443on the http connector. In ourweb.xmlwe are setting thesecurity-containtsas described in this article 'Forcing requests tohttpsin JBoss and Tomcat' - https://access.redhat.com/site/solutions/37664 , but when we do a http get on our http://hostname/example/test servlet, it is trying to connect to8443instead of the443we have configured in theserver.xml
<Connector protocol="HTTP/1.1" port="80" address="${jboss.bind.address}"
connectionTimeout="200000" redirectPort="443" bufferSize="2048" server="MyServer"/>
<Connector protocol="HTTP/1.1" SSLEnabled="true"
port="443" address="${jboss.bind.address}"
scheme="https" secure="true" clientAuth="false"
keystoreFile="${jboss.server.home.dir}/conf/jbossweb.keystore"
keystorePass="keystorepass"
truststoreFile="${jboss.server.home.dir}/conf/jbossweb.truststore"
truststorePass="truststorepass"
sslProtocol = "TLS" server="MyServer"/>
web.xml:
<security-constraint>
<web-resource-collection>
<web-resource-name>NoAccess</web-resource-name>
<url-pattern>/*</url-pattern>
<http-method>DELETE</http-method>
<http-method>PUT</http-method>
<http-method>GET</http-method>
<http-method>POST</http-method>
<http-method>HEAD</http-method>
<http-method>OPTIONS</http-method>
<http-method>TRACE</http-method>
</web-resource-collection>
<user-data-constraint>
<transport-guarantee>CONFIDENTIAL</transport-guarantee>
</user-data-constraint>
</security-constraint>
wget http://hostname.com/example/test.jsp
--2013-09-28 08:56:36-- http://hostname.com/example/test.jsp
Resolving hostname.com (hostname.com)... 192.168.1.101
Connecting to hostname.com (hostname.com)|192.168.1.101|:80... connected.
HTTP request sent, awaiting response... 302 Moved Temporarily
Location: https://hostname.com:8443/example/test.jsp [following]
--2013-09-28 08:56:37-- https://hostname.com:8443/example/test.jsp
Connecting to hostname.com (hostname.com)|192.168.1.101|:8443...
Environment
- Red Hat JBoss Enterprise Application Platform (EAP)
- 5.1.1
- 5.1.0
- 5.0.x
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.
Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.
