'Issue with Keycloak and Cloudflare

I'm running a web site and I secured it with Keycloak, with running Cloudflare as well.

All the login forms, registration forms etc. are used by Keycloak, so I do redirections from my site to Keycloak and vice versa.

Now all of this works perfectly fine, except for logging out. So, on the secured web site, on logout I redirect to Keycloak's URL:

https://my-keycloak.com/auth/realms/my-realm-name/protocol/openid-connect/logout?redirect_uri=https://my-site.com

For some reason, Cloudflare gives me a 520 Error. I've read on Troubleshooting Cloudflare and none of the usual causes seem applicable here, as, without Cloudflare, this works fine.

Troubleshooting Cloudflare - 5xx

Nothing from the 5xx list on the above link really is related to what happens here. I've inspected the logout (without Cloudflare) and it's just few 302 redirections before landing on a login form in the end.

Has anyone else experienced similar issues? What could cause this?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source