ximarin
ximarin

Reputation: 401

JBoss 5.1.0.GA - Redirect to port 443 not working, always get redirected to 8443

I have an issue with setting up a redirect from 8080 to port 443.

Here the scenario: I have a load balancer, listening to ports 80 and 443. All requests for port 80 are forwarded to port 8080 on the hosts behind the load balancer. All requests for port 443 are forwarded to port 8443 on the hosts behind the load balancer.

When a request comes for port http://address.com, it is using port 80 on the load balancer and port 8080 on the host, everything fine here.

The redirect should now point to https://address.com:443, but instead points to https://address.com:8443 which the load balancer does not understand and therefore the request dies.

I also tried changing the https port for the https connector to 443 (not really knowing where the port information is coming from) with no effect, still port 8443 is used.

Anyone has an idea what I need to change to allow 80 -> 8080 ==> 443 -> 8443?

Thanks in advance

Here the server.xml HTTP connector:

<Connector protocol="HTTP/1.1" 
  port="8080"
  address="${jboss.bind.address}"
  connectionTimeout="20000"
  redirectPort="443"
  compression="2048"
  compressableMimeTypes="text/html,text/xml,text/plain,text/css,text/javascript"
  URIEncoding="UTF-8"/>

Here the corresponding HTTPS connector:

  <Connector protocol="HTTP/1.1"
    SSLEnabled="true"
    port="8443"
    address="${jboss.bind.address}"
    compression="2048"
    compressableMimeTypes="text/html,text/xml,text/plain,text/css,text/javascript"
    scheme="https"
    secure="true"
    clientAuth="false"
    sslProtocol = "TLS" 
    ... keystore stuff ...
    />

And the confidential block from web.xml

<security-constraint>
    <web-resource-collection>
        <web-resource-name>Security Required</web-resource-name>
        <url-pattern>/*</url-pattern>
    </web-resource-collection>
    <user-data-constraint>
        <transport-guarantee>CONFIDENTIAL</transport-guarantee>
    </user-data-constraint>
</security-constraint>

Upvotes: 2

Views: 1172

Answers (1)

ximarin
ximarin

Reputation: 401

I found a workaround for this googling the web (lost the actual page I found it on :( )

In server/default/conf/bindingservice.beans/META-INF/bindings-jboss-beans.xml is a xsl transformation done to the redirect port:

  <xsl:when test="(name() = 'redirectPort')">
    <xsl:attribute name="redirectPort">
      <xsl:value-of select="$portHttps" />
    </xsl:attribute>
  </xsl:when>

Commenting this out (changing it to):

<!--
  <xsl:when test="(name() = 'redirectPort')">
    <xsl:attribute name="redirectPort">
      <xsl:value-of select="$portHttps" />
    </xsl:attribute>
  </xsl:when>
-->

now redirects correctly.

Upvotes: 2

Related Questions