keycloak 17 behind nginx reverse proxy redirects admin console to port 443 instead of 8444
See original GitHub issueDescribe the bug
Hi, I setup keycloak 17
on Ubuntu 20.04
, openjdk-11-jre
and reverse peroxided by nginx 1.18.0
.
It’s this setup is okay on production https port 443, but when I try change it and serve it on different port for example 8444 it doesn’t work and redirects to 443!
Version
17
Expected behavior
I Expected to redirects me to nginx port which I was serving 8444
Actual behavior
But it redirects me to port 443
How to Reproduce?
Download Keycloak 17
and install openjdk-11-jre
& nginx 1.18.0
on Ubuntu 20.04
.
create TLS certificates and run in production mode with these configurations.
db-url-host=10.10.10.10 # postgres server
db=postgres
db-username=keycloak
db-password=keycloak
hostname=key-test.xxxxxxxxx.ir
http-enabled=true
https-certificate-file=/etc/ssl/certs/pem.pem
https-certificate-key-file=/etc/ssl/private/key.key
https-port=8443
proxy=passthrough
and this Nginx configuration:
##
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
upstream keykloack{
server key-test.xxxxxxxxx.ir:8443;
}
server {
listen 80;
server_name key-test.xxxxxxxxx.ir;
return 301 https://$server_name:8444$request_uri;
}
server {
listen 8444 ssl http2;
server_name key-test.xxxxxxxxx.ir;
ssl_certificate /etc/ssl/certs/pem.pem;
ssl_certificate_key /etc/ssl/private/key.key;
error_page 497 https://$server_name:8444$request_uri;
location / {
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_set_header Host $http_host;
proxy_pass https://keykloack;
}
}
Anything else?
I look for it on documentation but didn’t found any thing relative to s, once again thank you guys for help and support 😃
Issue Analytics
- State:
- Created 2 years ago
- Comments:17 (2 by maintainers)
Top Results From Across the Web
Keycloak 17.0.1 behind NginX reverse proxy
I have nginx proxy with such config: nginx: build: src/nginx environment: ENVIRONMENT_NAME: Development ports: - "3000:80"
Read more >Using a reverse proxy - Keycloak
The proxy instead is forwarding requests to the Keycloak server so that secure connections between the server and clients are based on the...
Read more >Using Keycloak behind a reverse proxy: Could not open ...
First, I setup reverse proxy with cloak at a clean env, confirm that the proxy and ... You should set jboss.https.port 443 for...
Read more >Nginx As Reverse Proxy In Front Of Keycloak - ITNEXT
Locally, in the root directory, create a file named .env and write the Keycloak admin password in it, like this KEYCLOAK_PASSWORD=mysecret!
Read more >keycloak + nginx reverse proxy + too many redirects issue
Hi everyone, I am experimenting "too many redirects"/infinite loops issues in the browser when I try to connect with social providers.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I can confirm that 17.0.0 and 17.0.1 seem to work differently. On 17.0.1 we get the blank admin page with our configuration but with 17.0.0 it works just fine. Is there a best practice configuration example for keycloak 17.0.1 behind a reverse proxy (nginx in our case?)
Breaking update!!! I got stuff working (finally)
These are my final environment variable definition:
And I also changed the docker entrypoint by setting
Of course, I’m also forwarding all of required headers from nginx.
So what’s broken:
KC_PROXY
stopped working properly starting with 17.0.1. This is yet to be fixed. So be sure to specify the--proxy
mode using the entrypoint.KC_HOSTNAME_PORT
seems to break the deployment, so be sure it’s absent. See https://github.com/keycloak/keycloak/issues/11083