<div dir="ltr">You may be missing the ProxyPeerHandler filter registration with your undertow subsystem. Below example of running keycloak behind a stock standard Apache Reverse proxy configuration with the corresponsing undertow subsystem configuration.<div><br></div><div>I never understood what that <font face="monospace, monospace" size="1">proxy-https</font> port configuration in the binding was good for (I think its a copy paste habit or legacy) using the default 8443 one has always worked for me.<br><div><br></div><div><div><font face="monospace, monospace" size="1">&lt;subsystem xmlns=&quot;urn:jboss:domain:undertow:3.0&quot;&gt;</font></div><div><font face="monospace, monospace" size="1">    &lt;buffer-cache name=&quot;default&quot;/&gt;</font></div><div><font face="monospace, monospace" size="1">    &lt;server name=&quot;default-server&quot;&gt;</font></div><div><font face="monospace, monospace" size="1">        &lt;ajp-listener name=&quot;ajp-default&quot; socket-binding=&quot;ajp&quot; redirect-socket=&quot;<font color="#ff0000">https</font>&quot; scheme=&quot;<font color="#ff0000">https</font>&quot;/&gt;</font></div><div><font face="monospace, monospace" size="1">        &lt;http-listener name=&quot;http-default&quot; socket-binding=&quot;http&quot; redirect-socket=&quot;https&quot; </font><span style="font-family:monospace,monospace;font-size:x-small">proxy-address-forwarding=&quot;</span><font color="#ff0000" style="font-family:monospace,monospace;font-size:x-small">true</font><span style="font-family:monospace,monospace;font-size:x-small">&quot;</span><span style="font-family:monospace,monospace;font-size:x-small">/&gt;</span></div><div><font face="monospace, monospace" size="1">        &lt;host name=&quot;default-host&quot; alias=&quot;localhost&quot;&gt;</font></div><div><font face="monospace, monospace" size="1">            &lt;location name=&quot;/&quot; handler=&quot;welcome-content&quot;/&gt;</font></div><div><font face="monospace, monospace" size="1">            &lt;filter-ref name=&quot;server-header&quot;/&gt;</font></div><div><font face="monospace, monospace" size="1">            &lt;filter-ref name=&quot;x-powered-by-header&quot;/&gt;</font></div><div><font face="monospace, monospace" size="1" color="#ff0000">            &lt;filter-ref name=&quot;proxy-peer&quot;/&gt;</font></div><div><font face="monospace, monospace" size="1">            &lt;filter-ref name=&quot;request-dumper&quot; priority=&quot;30&quot;/&gt;</font></div><div><font face="monospace, monospace" size="1">        &lt;/host&gt;</font></div><div><font face="monospace, monospace" size="1">    &lt;/server&gt;</font></div><div><font face="monospace, monospace" size="1">    &lt;servlet-container name=&quot;default&quot;&gt;</font></div><div><font face="monospace, monospace" size="1">        &lt;jsp-config/&gt;</font></div><div><font face="monospace, monospace" size="1">        &lt;websockets/&gt;</font></div><div><font face="monospace, monospace" size="1">    &lt;/servlet-container&gt;</font></div><div><font face="monospace, monospace" size="1">    &lt;handlers&gt;</font></div><div><font face="monospace, monospace" size="1">        &lt;file name=&quot;welcome-content&quot; path=&quot;${jboss.home.dir}/welcome-content&quot;/&gt;</font></div><div><font face="monospace, monospace" size="1">    &lt;/handlers&gt;</font></div><div><font face="monospace, monospace" size="1">    &lt;filters&gt;</font></div><div><font face="monospace, monospace" size="1">        &lt;response-header name=&quot;server-header&quot; header-name=&quot;Server&quot; header-value=&quot;WildFly/10&quot;/&gt;</font></div><div><font face="monospace, monospace" size="1">        &lt;response-header name=&quot;x-powered-by-header&quot; header-name=&quot;X-Powered-By&quot; header-value=&quot;Undertow/1&quot;/&gt;</font></div><div><font face="monospace, monospace" size="1" color="#ff0000">        &lt;filter name=&quot;proxy-peer&quot; module=&quot;io.undertow.core&quot; class-name=&quot;io.undertow.server.handlers.ProxyPeerAddressHandler&quot;/&gt;</font></div><div><font face="monospace, monospace" size="1">        &lt;filter name=&quot;request-dumper&quot; module=&quot;io.undertow.core&quot; class-name=&quot;io.undertow.server.handlers.RequestDumpingHandler&quot;/&gt;</font></div><div><font face="monospace, monospace" size="1">    &lt;/filters&gt;</font></div><div><font face="monospace, monospace" size="1">&lt;/subsystem&gt;</font></div></div><div><br></div><div>The socket config</div><div><br></div><div><div><font face="monospace, monospace" size="1">&lt;socket-binding-group name=&quot;standard-sockets&quot; default-interface=&quot;public&quot; port-offset=&quot;${jboss.socket.binding.port-offset:0}&quot;&gt;</font></div><div><font face="monospace, monospace" size="1">    &lt;socket-binding name=&quot;management-http&quot; interface=&quot;management&quot; port=&quot;${jboss.management.http.port:9990}&quot;/&gt;</font></div><div><font face="monospace, monospace" size="1">    &lt;socket-binding name=&quot;management-https&quot; interface=&quot;management&quot; port=&quot;${jboss.management.https.port:9993}&quot;/&gt;</font></div><div><font face="monospace, monospace" size="1">    &lt;socket-binding name=&quot;<font color="#ff0000">ajp</font>&quot; port=&quot;${jboss.ajp.port:8009}&quot;/&gt;</font></div><div><font face="monospace, monospace" size="1">    &lt;socket-binding name=&quot;http&quot; port=&quot;${jboss.http.port:8080}&quot;/&gt;</font></div><div><font face="monospace, monospace" size="1">    &lt;socket-binding name=&quot;<font color="#ff0000">https</font>&quot; port=&quot;${jboss.https.port:8443}&quot;/&gt;</font></div><div><font face="monospace, monospace" size="1">    &lt;socket-binding name=&quot;txn-recovery-environment&quot; port=&quot;4712&quot;/&gt;</font></div><div><font face="monospace, monospace" size="1">    &lt;socket-binding name=&quot;txn-status-manager&quot; port=&quot;4713&quot;/&gt;</font></div><div><font face="monospace, monospace" size="1">    &lt;outbound-socket-binding name=&quot;mail-smtp&quot;&gt;</font></div><div><font face="monospace, monospace" size="1">        &lt;remote-destination host=&quot;localhost&quot; port=&quot;25&quot;/&gt;</font></div><div><font face="monospace, monospace" size="1">    &lt;/outbound-socket-binding&gt;</font></div><div><font face="monospace, monospace" size="1">&lt;/socket-binding-group&gt;</font></div><div><br></div><div>And the minimalistic snippet that goes into the apache vhost config (apache 2.4)</div><div><br></div><div><div><font face="monospace, monospace" size="1">&lt;VirtualHost *:80&gt;</font></div><div><font face="monospace, monospace" size="1">  DocumentRoot /var/www</font></div><div><font face="monospace, monospace" size="1">  ServerName <a href="http://your.server.com">your.server.com</a></font></div><div><span style="font-family:monospace,monospace;font-size:x-small">  RewriteEngine On</span><br></div><div><span style="font-family:monospace,monospace;font-size:x-small">  RewriteCond %{HTTPS} !=on</span><br></div><div><span style="font-family:monospace,monospace;font-size:x-small">  RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R=301,L]</span><br></div><div><font face="monospace, monospace" size="1">  ... logging config</font></div><div><span style="font-family:monospace,monospace;font-size:x-small">&lt;/VirtualHost&gt;</span><br></div><div><font face="monospace, monospace" size="1"><br></font></div><div><font face="monospace, monospace" size="1">&lt;VirtualHost *:443&gt;</font></div><div><font face="monospace, monospace" size="1">  DocumentRoot /var/www</font></div><div><font face="monospace, monospace" size="1">  ServerName <a href="http://your.server.com">your.server.com</a></font></div><div><span style="font-family:monospace,monospace;font-size:x-small">  ... ssl config</span><br></div><div><span style="font-family:monospace,monospace;font-size:x-small"><br></span></div><div><span style="font-family:monospace,monospace;font-size:x-small">  ProxyRequests Off</span><br></div><div><font face="monospace, monospace" size="1">  ProxyPreserveHost On</font></div><div><span style="font-family:monospace,monospace;font-size:x-small">  &lt;Proxy *&gt;</span><br></div><div><font face="monospace, monospace" size="1">    RequestHeader set X-Forwarded-Proto &quot;https&quot;</font></div><div><font face="monospace, monospace" size="1">    Require all granted</font></div><div><font face="monospace, monospace" size="1">  &lt;/Proxy&gt;</font></div><div><font face="monospace, monospace" size="1">  </font></div><div><font face="monospace, monospace" size="1">  # ajp works a charm</font></div><div><span style="font-family:monospace,monospace;font-size:x-small">  ProxyPass /auth ajp://<a href="http://127.0.0.1:8009/auth">127.0.0.1:8009/auth</a></span><br></div><div><font face="monospace, monospace" size="1">  ProxyPassReverse /auth ajp://<a href="http://127.0.0.1:8009/auth">127.0.0.1:8009/auth</a></font></div><div><font face="monospace, monospace" size="1">  </font></div><div><font face="monospace, monospace" size="1">  # or hit the http port</font></div><div><div><span style="font-family:monospace,monospace;font-size:x-small">  ProxyPass /auth <a href="http://127.0.0.1:8080/auth">http://127.0.0.1:8080/auth</a></span><br></div><div><font face="monospace, monospace" size="1">  ProxyPassReverse /auth <a href="http://127.0.0.1:8080/auth">http://127.0.0.1:8080/auth</a></font></div></div><div><span style="font-family:monospace,monospace;font-size:x-small"><br></span></div><div><span style="font-family:monospace,monospace;font-size:x-small">  ... logging config</span></div><div><font face="monospace, monospace" size="1">&lt;/VirtualHost&gt;</font></div></div><div><br></div><div><br></div><div>Hope this solves your problem.</div><div><br></div><div>Cheers,</div><div>Niels</div><div><br></div></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Jul 22, 2016 at 7:21 AM, Derek Visch <span dir="ltr">&lt;<a href="mailto:derek.visch@gmail.com" target="_blank">derek.visch@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Trying to setup reverse SSL for keycloak. Having issues finding documentation about this, it&#39;s mentioned in <a href="https://keycloak.gitbooks.io/server-installation-and-configuration/content/v/2.0/topics/network/https.html" target="_blank">https://keycloak.gitbooks.io/server-installation-and-configuration/content/v/2.0/topics/network/https.html</a> but the extra detail that&#39;s supposed to be in <a href="https://keycloak.gitbooks.io/server-adminstration-guide/content/" target="_blank">https://keycloak.gitbooks.io/server-adminstration-guide/content/</a> I could not find in regards to reverse SSL proxys.<div><br></div><div>Regardless I ended up following <a href="http://lists.jboss.org/pipermail/keycloak-user/2014-June/000453.html" target="_blank">http://lists.jboss.org/pipermail/keycloak-user/2014-June/000453.html</a> </div><div><br></div><div>From that previous mailling list post:<br><br></div><div><pre style="color:rgb(0,0,0)">Follow the documentation for your web server to enable SSL and configure reverse proxy for Keycloak. It is important that you make sure the web server sets the X-Forwarded-For and X-Forwarded-Proto headers on the requests made to Keycloak. Next you need to enable proxy-address-forwarding on the Keycloak http connector. Assuming that your reverse proxy doesn&#39;t use port 8443 for SSL you also need to configure what port http traffic is redirected to. This is done by editing standalone/configuration/standalone.xml.

First add proxy-address-forwarding and redirect-socket to the http-listener element:

&lt;subsystem xmlns=&quot;urn:jboss:domain:undertow:1.1&quot;&gt;
    ...
    &lt;http-listener name=&quot;default&quot; socket-binding=&quot;http&quot; proxy-address-forwarding=&quot;true&quot; redirect-socket=&quot;proxy-https&quot;/&gt;
    ...
&lt;/subsystem&gt;

Then add a new socket-binding element to the socket-binding-group element:

&lt;socket-binding-group name=&quot;standard-sockets&quot; default-interface=&quot;public&quot; port-offset=&quot;${jboss.socket.binding.port-offset:0}&quot;&gt;
    ...
    &lt;socket-binding name=&quot;proxy-https&quot; port=&quot;443&quot;/&gt;
    ...
&lt;/socket-binding-group&gt;</pre></div><div><br></div><div><br></div><div>but now when I go to log on to the admin console I get &quot;We&#39;re sorry ... Invalid aparameter: redirect uri&quot;. </div><div><br></div><div><br></div><div><br></div><div>Tried stack overflow / google / IRC. No luck so far. </div><div><br></div><div>Any help would be appreciated :D</div><div><br></div><div>Thanks</div><div><br></div><div><br><div data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"></div></div></div></div>
</div></div>
<br>_______________________________________________<br>
keycloak-user mailing list<br>
<a href="mailto:keycloak-user@lists.jboss.org">keycloak-user@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/keycloak-user" rel="noreferrer" target="_blank">https://lists.jboss.org/mailman/listinfo/keycloak-user</a><br></blockquote></div><br></div>