# X-Forwarded-Proto

# Summary

A spinner of "Loading the admin console ..." never finished when I try to open the Administration console of keycloak behind the HAproxy. Then looking at the browser console, there is an error indicating that a request to the keycloak is said "Mixed Contents".

# Conclusion

It may be because there is no X-Forwarded-Proto in the backend description of haproxy.

# Issue

Open keycloak behind the haproxy.

A spinner of "Loading the admin console ..." never finished when I try to open the Administration console of keycloak behind the HAproxy. Then looking at the browser console, there is an error indicating that a request to the keycloak is said "Mixed Contents".

# Cause

As the error message indicates, the protocol of request to keycloak is wrong as http of http://keycloak instead https

# Solution

Add X-Forwarded-Proto to the backend for keycloak on the file haproxy.cfg as follow so that the access protocol from haproxy to keycloak is https.


 


backend keycloak
	http-request add-header X-Forwarded-Proto https if { ssl_fc }
  server keycloak 				127.0.0.1:8080

# That's it!

Successfully opened the Administration console.


Last Updated: 12/12/2022, 3:41:19 AM