Open dolgovas opened 11 months ago
Something probably broken with the refresh process. Check the error log for OIDC refresh failure
messages.
2023/11/29 13:27:59 [info] 2722823#2722823: *603571 expired JWT token while sending to client, client: 192.168.10.15, server: main.example.com, request: "GET /service", host: "main.example.com", referrer: "https://main.example.com/"
2023/11/29 13:27:59 [info] 2722823#2722823: *603571 expired JWT token while sending to client, client: 192.168.10.15, server: main.example.com, request: "GET /service", host: "main.example.com", referrer: "https://main.example.com/"
2023/11/29 13:27:59 [info] 2722823#2722823: *603571 expired JWT token while sending to client, client: 192.168.10.15, server: main.example.com, request: "GET /service", host: "main.example.com", referrer: "https://main.example.com/"
2023/11/29 13:27:59 [info] 2722823#2722823: *603571 expired JWT token while sending to client, client: 192.168.10.15, server: main.example.com, request: "GET /service", host: "main.example.com", referrer: "https://main.example.com/"
2023/11/29 13:28:03 [info] 2722823#2722823: *603571 expired JWT token while sending to client, client: 192.168.10.15, server: main.example.com, request: "GET /service", host: "main.example.com", referrer: "https://main.example.com/"
only this in debug error.log
It seems like nginx cannot refresh access token... but why? Where I can get additional logs? May be it's possible to run njs script with additional output?
One more thing. If timeout for keyval zone is less than ttl acess token - infinite loop starts before expiration access token, right after remove token from nginx_kv
I think I fixed this.
First one I needed to enable refresh tokens
in keycloak, because in latest version it disabled by default!
Second one I added
proxy_set_header Accept-Encoding "gzip";
only into /_jwks_uri and /_token
, like said in to-do troubleshooting. BUT it seems that I need to add gzip also in /_refresh
location.
After these changes everything working correctly
Good news. Looks like the troubleshooting guide needs an extra item!
Good day! I ran my test installation through this guide (https://docs.nginx.com/nginx/deployment-guides/single-sign-on/keycloak/)
And started to get infinite loop after access token expired. It seems strange.
First step go the site https://main.example.com/ step 2 -> 302 redirect to https://keycloak.example.com/ step 3 -> auth in keycloak step 4 -> 302 to https://main.example.com/ step 5 -> after 5 minutes (access token ttl) browser started return 302 from main.example.com to keycloak, keycloak send 302 to main.example and infinite loop....
and unmodified js/openid_connect.js; from main branch