question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

shinyproxy generate wrong redirect uri when using keycloak

See original GitHub issue

Hello,

my setup is like this.

shinyproxy runs in a docker container with name shiny-proxy.

apache httpd reverse proxy runs before shinyproxy and convert it to https and runs on the host with port 2443 keycloak is also runs in docker container but the port is open on the host with 8443.

setup, application.xml

 keycloak:
    realm: shiny
    auth-server-url: https://keycloak:8443/auth
    #ssl-required: none
    ssl-required: external
    confidential-port: 2443
    verify-token-audience: true
    resource: shiny-proxy-p1
    credentials-secret: xxxxxxxxxxxx

apache reverse proxy configuration

<VirtualHost *:2443>
  SSLEngine on
  SSLCertificateFile    /etc/apache2/ssl/server-cert.pem
  SSLCertificateKeyFile /etc/apache2/ssl/server-cert.key
  #   Server Certificate Chain:
  #   Point SSLCertificateChainFile at a file containing the
  #   concatenation of PEM encoded CA certificates which form the
  #   certificate chain for the server certificate. Alternatively
  #   the referenced file can be the same as SSLCertificateFile
  #   when the CA certificates are directly appended to the server
  #   certificate for convinience.
  SSLCertificateChainFile /etc/apache2/ssl/server-ca.crt


  <Proxy *>
    Allow from *
  </Proxy>

  RewriteEngine on
 RewriteCond %{HTTP:Upgrade} =websocket
 RewriteRule /(.*) ws://shiny-proxy:8080/$1 [P,L]
 RewriteCond %{HTTP:Upgrade} !=websocket
 RewriteRule /(.*) http://shiny-proxy:8080/$1 [P,L]
 ProxyPass / http://shiny-proxy:8080/
 ProxyPassReverse / http://shiny-proxy:8080/
 ProxyRequests Off

 ErrorLog ${APACHE_LOG_DIR}/proxy_error.log
 CustomLog ${APACHE_LOG_DIR}/proxy_access.log combined

</VirtualHost>

Let’s say when access shinyprox via apache with URL https://lxsqlpocnd04:2443/ it will redirect to login page and the login page redirect request to Keycloak host lxsqlpocnd04 and port 8443. in that URL there is query string which includes redirect_uri but it is not the one expected.

the URL is like this https://lxsqlpocnd04:8443/auth/realms/shiny/protocol/openid-connect/auth?response_type=code&client_id=shiny-proxy-p1&redirect_uri=http%3A%2F%2Fshiny-proxy%3A8080%2Fsso%2Flogin&state=00f5e087-e6a9-4768-8cf8-39d77500fea3&login=true&scope=openid

And the redirect_uri is http://shiny-proxy:8080/sso/login other than https://lxsqlpocnd04:2443/sso/login

could someone help ?

Thanks,

Robin

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:16 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
tverbekecommented, Nov 28, 2020

@danielfm123 @eastclintw00d POST requests (as made e.g. by DT) don’t work when using OIDC with current ShinyProxy (2.4.1). A fix by @LEDfan will be part of an upcoming release, but this is not the topic of this thread.

1reaction
eastclintw00dcommented, Nov 25, 2020

Hi @LEDfan

That solved the problem.

Thank you for the quick response!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Keycloak redirected too many times - ShinyProxy
I'm trying to get a basic example of shinyproxy working with keycloak. This is my Dockerfile FROM openjdk:11-jre RUN mkdir -p ...
Read more >
FAQ
Invalid redirect_uri when using OpenID Connect or Keycloak. When authenticating using OpenID, ShinyProxy first redirects the user to the IDP. In this ...
Read more >
Shinyproxy with keycloak redirected too many times
When I go to http://localhost:8020/ and authenticate with the user I created in http://localhost:8010/ I get a redirected too many times error.
Read more >
Keycloak Gatekeeper Shinyproxy NULL Authentication #244
I tried to make authentication using a keycloak. But there are some problems, including redirect uri always to / sso / login.
Read more >
Keycloak with reverse proxy using nginx error redirect uri ...
I have a spring boot application running on digital ocean server behind nginx server using keycloak for login.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found