Not able to redirect keycloak via Nginx.

2,022 views
Skip to first unread message

Vinod Kumar

unread,
Jul 5, 2022, 5:24:08 AM7/5/22
to Keycloak User
Hi, we have installed quarkus keycloak in dev mode using below docker run command.

docker run --name keycloak18_test -p 8080:8080 quay.io/keycloak/keycloak start-dev --hostname=hostname  --db=postgres --db-url=jdbc:postgresql://postgreshostname:5432/VUKeycloak_v17_qurakus --db-username=postgres  --http-relative-path=/auth

we are able to access the keycloak using the keycloak hostname. http://hostname/auth/ and 'Administration console' is promting for user name and password, which is good.

We have Nginx and we would like redirect keycloak via Nginx. here is location block added in Nginx.

 location /auth {
proxy_pass http://keycloakhostname:8080/auth;
proxy_set_header Upgrade           $http_upgrade;
proxy_set_header Connection        "upgrade";
proxy_set_header Host              $host;
proxy_set_header X-Real-IP         $remote_addr;
proxy_set_header X-Forwarded-For   $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Host  $host;
proxy_set_header X-Forwarded-Port  $server_port;
}

and when trying to accessing keycloak via nginx https://myhostname/auth it is giving the administration console page and when I click on the 'Administration console" it is blank and when I inspect it shows below error

Mixed Content: The page at 'https://myhostname/auth/admin/master/console/' was loaded over HTTPS, but requested an insecure frame 'http://keycloakhostname/auth/realms/master/protocol/openid-connect/3p-cookies/step1.html?version=s2b7u'. This request has been blocked; the content must be served over HTTPS.

Do you have any suggestions here please?

Björn Pedersen

unread,
Jul 6, 2022, 3:16:15 AM7/6/22
to Keycloak User
vini.p...@gmail.com schrieb am Dienstag, 5. Juli 2022 um 11:24:08 UTC+2:
Hi, we have installed quarkus keycloak in dev mode using below docker run command.


Do you have any suggestions here please?



=> you  need to set proxy-mode=edge

Vinod Kumar

unread,
Jul 6, 2022, 3:38:53 AM7/6/22
to Keycloak User
Hi,

Thank you for your response, I have tried using the proxy-mode=edge and when I inspect this time, it gives me this error. Any suggestions please to overcome this issue?

VM10:6773 crbug/1173575, non-JS module files deprecated.

Vinod Kumar

unread,
Jul 6, 2022, 3:45:06 AM7/6/22
to Keycloak User

I'm getting the below error not only while redirecting via Nginx and the base url is also has the same issue when I used proxy-mode=edge.

VM10:6773 crbug/1173575, non-JS module files deprecated.

Björn Pedersen

unread,
Jul 6, 2022, 7:42:07 AM7/6/22
to Keycloak User


VM10:6773 crbug/1173575, non-JS module files deprecated.


You try to start from VS studio code? Just google the crbug code and you find tons of solutions. 

Thomas

unread,
Jul 6, 2022, 2:32:46 PM7/6/22
to Vinod Kumar, Keycloak User
Not seeing your error in the email.  
I recently setup a proxy for it.  Although,  I used passthrough instead of edge.  One thing I initially missed was the headers
From the documentation
  • Set the X-Forwarded-For, X-Forwarded-Proto, and X-Forwarded-Host HTTP headers.



--
You received this message because you are subscribed to the Google Groups "Keycloak User" group.
To unsubscribe from this group and stop receiving emails from it, send an email to keycloak-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/keycloak-user/0606ef90-c200-41d0-a967-4b082627dff2n%40googlegroups.com.

Welton Torres

unread,
Jul 7, 2022, 10:16:09 AM7/7/22
to Thomas, Vinod Kumar, Keycloak User
Reply all
Reply to author
Forward
0 new messages