Deployed app responds randomly with 503s

Hello everyone, when I open the admin dashboard of a deployed KeyCloak instance, I get 503's instead of the resource for random web resources (images, JS files, html files,...). In the browser's network console you can then see the Railway "Application failed to respond" page in the bodies of the 503. I have to reload the page several times until all the resources needed for the dashboard could be loaded. The problem has existed for quite a while. In the logs of the deployed KeyCloak instance there is no indication that anything is wrong (so no noticeable error logs or anything like that)
Solution:
okay so for context, i have seen this before with keycloak, sometimes its server sends malformed responses that envoy (railway's proxy) does not like, the solution was to run a caddy proxy in the same container in parallel and expose the caddy proxy only, caddy would internally proxy to keycloak, thus smoothing over the responses from keycloak's server (for lack of a better term) You can see how i have implmented that here: https://github.com/leonardochappuis/keycloak-docker...
Jump to solution
22 Replies
Percy
Percyβ€’8mo ago
Project ID: f751037a-ba7a-42ab-8a24-90e99fcd12d3
Collectors Comet
Collectors CometOPβ€’8mo ago
f751037a-ba7a-42ab-8a24-90e99fcd12d3
Brody
Brodyβ€’8mo ago
you had it working before right?
Collectors Comet
Collectors CometOPβ€’8mo ago
I've had this problem for what feels like forever. I think the 503s always appeared randomly for this app
Brody
Brodyβ€’8mo ago
i take it you have not deployed keycloak from the template then?
Collectors Comet
Collectors CometOPβ€’8mo ago
Yeah, i am using a "selfmade"-DockerImage
Solution
Brody
Brodyβ€’8mo ago
okay so for context, i have seen this before with keycloak, sometimes its server sends malformed responses that envoy (railway's proxy) does not like, the solution was to run a caddy proxy in the same container in parallel and expose the caddy proxy only, caddy would internally proxy to keycloak, thus smoothing over the responses from keycloak's server (for lack of a better term) You can see how i have implmented that here: https://github.com/leonardochappuis/keycloak-docker
Collectors Comet
Collectors CometOPβ€’8mo ago
Thank you very much! I will try it and post the result here
Brody
Brodyβ€’8mo ago
let me know if you have any issues!
Collectors Comet
Collectors CometOPβ€’8mo ago
I can not believe it but it seems like it works now πŸ˜ƒ I reloaded the Dashboard 10 times and could not produce one 503er Error Thank you very much Brody! I have still some question, about the topic: - What kind of malformed responses are keycloak sending? Is there an open ticket at KeyCloak for this? If the responses do not meet the Http specification, then that needs to be corrected. Or is the railway proxy too sensitive here?
Brody
Brodyβ€’8mo ago
What kind of malformed responses are keycloak sending?
i honestly have no clue
Is there an open ticket at KeyCloak for this?
i also have no clue
Or is the railway proxy too sensitive here?
this is more likely the case, envoy is getting removed in favour of railway's own home grown proxy anyway at some point
Collectors Comet
Collectors CometOPβ€’8mo ago
Does it then make sense to address the issue with Railway so that they can configure their proxy accordingly?
Brody
Brodyβ€’8mo ago
keycloak is the only thing i have seen have this issue, so no it doesnt really make sense for them to spend the time to fix this thing that likely only effects keycloak
Collectors Comet
Collectors CometOPβ€’8mo ago
fair enough (:
Brody
Brodyβ€’8mo ago
new proxy too, so also not worth the time when envoy is getting thrown out a window just curious too, where you using the latest version of keycloak?
Collectors Comet
Collectors CometOPβ€’8mo ago
One more little question: In the keycloak-Template-Repo there is this java.config: https://github.com/leonardochappuis/keycloak-docker/blob/master/java.config Do i need that too or why are this file there? Yeah i was using the latest Version of KeyCloak
Brody
Brodyβ€’8mo ago
i think that was to remove a newer auth version for database communications that the database railway deployed at the time didnt support, but now railway deploys up to date databases so you likely dont need to do that you are now using multirun and caddy in the container too?
Collectors Comet
Collectors CometOPβ€’8mo ago
right
Brody
Brodyβ€’8mo ago
awsome!
Collectors Comet
Collectors CometOPβ€’8mo ago
you can mark your answer as the solution
Collectors Comet
Collectors CometOPβ€’8mo ago
Bought your more Coffee for the help! You saved me many hours!
Brody
Brodyβ€’8mo ago
thank you very much, I appreciate that!!
Want results from more Discord servers?
Add your server