2

Question

How does one redirect a http-request to a https-request on the same port?


Use case

Someone opens mypage:1234 but omits the protocol. The user would expect to enter the page none the less.


Similar Problem(s)

The solution provided here would most likely solve my problem, but I dont know the domain name at compile time and a customer should not have to configure it afterwards.


Solution Attempt

standalone-full-template.xml

<subsystem>
  <server name="default-server">
    <host name="default-host" alias="localhost">
      <location name="/" handler="welcome-content"/>
      <http-invoker security-realm="ApplicationRealm"/>
      <filter-ref name="http-to-https" predicate="equals(%H,http) and equals(%p,1234)"/>
    </host>
  </server>
  <filters>
    <rewrite name="http-to-https" redirect="true" target="https://%v:1234%U"/>
  </filters>
</subsystem>

Sources

variables

0 Answers0