title: Forcing HTTPS redirect on Wildfly 10.0 directs to https://localhost:8443
body: <p>I am having a very challenging time forcing HTTPS on a Bitnami Ubutnu Wildfly 10 install.</p>
  
  <p>The HTTPS works fine (e.g.  <a href="https://example.com" rel="nofollow noreferrer">https://example.com</a>  works great)</p>
  
  <p>I have tried many different things with no result.  Here are some highlights of what I've done:</p>
  
  <p>I modified my web.xml to add this (note MYWEBNAME was replaced with my war file name):</p>
  
  <pre><code>&lt;security-constraint&gt;
      &lt;web-resource-collection&gt;
          &lt;web-resource-name&gt;MYWEBNAME&lt;/web-resource-name&gt;
          &lt;url-pattern&gt;/*&lt;/url-pattern&gt;
      &lt;/web-resource-collection&gt;
      &lt;user-data-constraint&gt;
          &lt;transport-guarantee&gt;CONFIDENTIAL&lt;/transport-guarantee&gt;
      &lt;/user-data-constraint&gt;
  &lt;/security-constraint&gt;          
  </code></pre>
  
  <p>I modified /opt/bitnami/apache2/conf/bitnami/bitnami.conf (as per <a href="https://docs.bitnami.com/aws/components/apache/" rel="nofollow noreferrer">https://docs.bitnami.com/aws/components/apache/</a>):</p>
  
  <pre><code>        &lt;VirtualHost _default_:80&gt;
                DocumentRoot /opt/bitnami/apache2/htdocs"
  ADD:          RewriteEngine On
  ADD:          RewriteCond %{HTTPS} !=on
  ADD:          RewriteRule ^/(.*) https://%{SERVER_NAME}/$1 [R,L]
            ...
          &lt;/VirtualHost&gt;
  </code></pre>
  
  <p>I modified standalone.xml</p>
  
  <pre><code>     &lt;management-interfaces&gt;
          &lt;http-interface security-realm="ApplicationRealm" http-upgrade-enabled="true"&gt;
              &lt;socket-binding https="management-https"/&gt;
          &lt;/http-interface&gt;
      &lt;/management-interfaces&gt;
  </code></pre>
  
  <p>I modified my root index.html to redirect to:</p>
  
  <pre><code>&lt;SCRIPT&gt;document.location="https://example.com";&lt;/SCRIPT&gt;
  </code></pre>
  
  <p>As per <a href="https://stackoverflow.com/questions/32008182/wildfly-9-http-to-https">Wildfly 9 http to https</a>, I tried this:      </p>
  
  <pre><code>    &lt;http-interface security-realm="ManagementRealm" http-upgrade-enabled="true"&gt;
          &lt;socket interface="management" secure-port="${jboss.management.http.port:9990}"/&gt;
      &lt;/http-interface&gt;
  </code></pre>
  
  <p>this resulted in a 503 error and wildfly to die, so I removed it.</p>
  
  <p>What I have now, is <a href="http://example.com" rel="nofollow noreferrer">http://example.com</a> redirecting to <a href="https://localhost:8443" rel="nofollow noreferrer">https://localhost:8443</a></p>
  
  <p>So I think it's close, I just cannot figure out how to make it redirect to <a href="https://example.com:8443" rel="nofollow noreferrer">https://example.com:8443</a> instead</p>