We have created a discourse that uses keycloack for login and providing user privileges. The discourse seem to work fine but suddenly sometimes I get to see this error message and through a 503 error.
Moments later it is coming back normal. Not able to replicate the issue if I follow the same steps. It is behaving extremely strange.
You might be able to narrow this issue down by opening your browser dev console and looking at the network tab (see image below).
Then, reload the page(s) and test, and you will more-than-likely see any HTTP network status messages like 404, 502, 403, (200 is good) etc and the file or external networking call which is the problem.
When there are JS errors, like this, the site is not going to work correctly, as you surely know, and this includes any special apps / libs for login, like keycloak.
My suggestion to you is to get your site up and running on HTTPS and try again.
Hope this helps.
See Also (from the keycloak site):
Next
Before you go and run Keycloak in production there are a few more things that you will want to do, including:
Switch to a production ready database such as PostgreSQL
Configure SSL with your own certificates
Switch the admin password to a more secure password
For more information check out the Keycloak Documentation.