# Keycloak SSL Redirect Loop

**URL:** <https://support.openanalytics.eu/t/keycloak-ssl-redirect-loop/430>\
**Category:** ShinyProxy\
**Created:** [January 15, 2018, 3:12pm UTC](https://support.openanalytics.eu/t/keycloak-ssl-redirect-loop/430 "2018-01-15T15:12:16Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mpsimimike](https://support.openanalytics.eu/letter_avatar_proxy/v4/letter/m/ad7895/32.png) [@mpsimimike](https://support.openanalytics.eu/u/mpsimimike)\
**Post date:** [January 15, 2018, 3:12pm UTC](https://support.openanalytics.eu/t/keycloak-ssl-redirect-loop/430/1 "2018-01-15T15:12:16Z")

</div>

Hey guys, first of all - thanks for developing this!

So far, shinyproxy is running smoothly with keycloak auth on my ubuntu/debian based vm. It’s running side by side on the same machine and everything works beautifully - until I try to switch to SSL 😉  
I’ve run out of ideas and am not sure what causes the problem - right now, I’m not even sure if this is a keycloak or shinyproxy issue.

My setup is as follows:  
shinyproxy running on vm on 8000  
keycloak running on same vm on 8080 for http and 8443 for https

Using plain http with 8000 and 8080 as keycloak auth url is working without any problems. shinyproxy redirects to the keycloak auth url and keycloak redirects back once a user is authenticated.

Using the https on 8443 as auth url is what causes some kind of redirect loop. It seems like keycloak authenticates the user, then redirects back to shinyproxy on 8000, which then in turn redirects back to /login and back on to keycloak. After a few times, the browser times out and tells “Too many redirects”:  
 ![](https://support.openanalytics.eu/uploads/default/original/1X/bb52d22fb4cf431da088cac8ed6ec7bba6efbdf3.JPG)

What have I tried so far:

Configured nginx as proxy with ssl rewrite - the problem persists, no matter if nginx is running with proxy\_pass and securing the domain as described in [https://www.shinyproxy.io/security/#https-ssl-tls](https://www.shinyproxy.io/security/#https-ssl-tls)

Followed these instructions to set up https on keycloak:  
[http://www.keycloak.org/docs/2.5/server\_installation/topics/network/https.html](http://www.keycloak.org/docs/2.5/server_installation/topics/network/https.html)  
Moving the keycloak server to another machine does not solve the problem either.  
The redirect issue on keycloak is discussed on SO or jboss. I did set the proxy-address-forwarding to true in the standalone.xml and played around with the redirect-socket as well as the redirect\_uri parameters, but nothing solved the issue.

Has somebody set this up with shinyproxy and keycloak with SSL and can help me?

Help is greatly appreciated! 😀

---

<div class="post-metadata">

**Author:** ![mpsimimike](https://support.openanalytics.eu/letter_avatar_proxy/v4/letter/m/ad7895/32.png) [@mpsimimike](https://support.openanalytics.eu/u/mpsimimike)\
**Post date:** [January 16, 2018, 8:28am UTC](https://support.openanalytics.eu/t/keycloak-ssl-redirect-loop/430/2 "2018-01-16T08:28:59Z")

</div>

> [@Shinyproxy ldaps with self-signed certificate](https://support.openanalytics.eu/t/shinyproxy-ldaps-with-self-signed-certificate/426/2):
>
> Hi @Edi_Sz,  
> To have ShinyProxy trust the self-signed certificate, it should be added into the trust store.
> 
> There are two ways to do this:
> 
> Add it into the default trust store of the JRE running ShinyProxy. This is usually JRE\_HOME/lib/security/cacerts. See [Import the Certificate as a Trusted Certificate (The Java™ Tutorials \> Security Features in Java SE \> Exchanging Files)](https://docs.oracle.com/javase/tutorial/security/toolfilex/rstep1.html) for more info.
> 
> Add it into a custom trust store and use that when launching ShinyProxy (using args -Djavax.net.ssl.trustStore and -Djavax.net.ssl.trustStorePassword)

This was the problem - thanks so much!
