Keycloak JS and CSS is not loading with nGinx Reverse proxy context path #46186
Replies: 12 comments 4 replies
-
|
Seems similar to #45064 Please use http-access-log-enabled=true and http-access-log-pattern=long and provide the log of requests hitting the Keycloak server. |
Beta Was this translation helpful? Give feedback.
-
|
Keycloak command run as:
Below is the logs as requested.
|
Beta Was this translation helpful? Give feedback.
-
|
@nshah14285 is that it? If so it would mean that the resource requests are not reaching the keycloak server. Can you provide an example of a client side url that is producing a 404 and confirm whether that is even reaching the keycloak server? |
Beta Was this translation helpful? Give feedback.
-
|
It looks like https://domain/kc/ reaches to keycloak server but the resources JS & CSS is not loading. Please find attached screenshot. |
Beta Was this translation helpful? Give feedback.
-
|
The screenshot confirms the browser is seeing a 404. Can you confirm the question from #46018 (comment) - do you see a 404 in the access logs as well? If not, then your issue is definitely with nginx. |
Beta Was this translation helpful? Give feedback.
-
|
Yes, 404 is getting logged in the nGinx access log.
|
Beta Was this translation helpful? Give feedback.
-
And what is in the Keycloak access log? Also, there seems to be a mismatch between the log and start-dev options shown in #46018 (comment) - the requests hitting the keycloak server have a context path of /kc, but start-dev is not configured to have an http-relative-path of /kc |
Beta Was this translation helpful? Give feedback.
-
|
Thanks for reporting this issue, but there is insufficient information or lack of steps to reproduce. Please provide additional details, otherwise this issue will be automatically closed within 14 days. |
Beta Was this translation helpful? Give feedback.
-
/kc is define in the hostname parameter. I have also tried passing http-relative-path=/kc but that was giving the same 404 for JS and CSS . Keycloak command run as:
Below is the keycloak access log
nGinx access log
|
Beta Was this translation helpful? Give feedback.
-
|
@nshah14285 this should confirm that the problem is with the nginx configuration. If the 404 requests are not reaching the Keycloak server, then your issue is with the proxy configuration. For example try using curl or other client to issue the resource request directly to the Keycloak server - curl -v http://localhost:8080/kc/resources/... |
Beta Was this translation helpful? Give feedback.
-
Localhost request works but through nGinx reverse proxy using keycloak relative path /kc resources are not loading. |
Beta Was this translation helpful? Give feedback.
-
|
At nginx, I have tried putting this simple config
The issue persists: JS and CSS are still not loading. Based on issues reported by others, this Nginx reverse-proxy problem seems to have started with Keycloak version 25 and above. Has anyone on your team encountered or resolved this issue before? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Before reporting an issue
Area
No response
Describe the bug
Hello,
Running keycloak latest version 26.5.2 behind nGinx reverse proxy using context path.
When we access the url https://test.example.com/kc the page only display this "Loading the Administration Console" with white background, JS and CSS is not loading throw 404 error.
Below is the nGinx config.
Keycloak command:
Even I have checked the issues mentioned by the others but it didn't worked.
If anything is missing in the nGinx config or keycloak command then please let me know.
Any help would be appreciated.
Thank You,
Nishit Shah
Version
26.5.2
Regression
Expected behavior
It should load the page properly.
Actual behavior
It should load the page properly.
How to Reproduce?
nGinx config mentioned above.
Anything else?
No response
Beta Was this translation helpful? Give feedback.
All reactions