# Redirection with AWS ALB

**URL:** <https://forum.keycloak.org/t/redirection-with-aws-alb/31381>\
**Category:** Configuring the server\
**Tags:** authentication\
**Created:** [May 25, 2026, 12:02am UTC](https://forum.keycloak.org/t/redirection-with-aws-alb/31381 "2026-05-25T00:02:21Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![SergioCea](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/sergiocea/32/10400_2.png) [@SergioCea](https://forum.keycloak.org/u/SergioCea)\
**Post date:** [May 25, 2026, 12:02am UTC](https://forum.keycloak.org/t/redirection-with-aws-alb/31381/1 "2026-05-25T00:02:21Z")

</div>

I’m configuring Keycloak under an ALB (Area Listed Building) and so far it’s been working correctly. The problem is that I have another service that connects to Keycloak through a namespace for internal communication.

This works correctly, but the problem is that when I log in, the service redirects me to the ALB using port 8080 instead of port 443.

The URL I’m configuring is http:///keycloak.demo:8080/realms/artisca/.well-known/openid-configuration

And it redirects me to https:///keycloak.mydomain.com:8080 (this isn’t the complete URL because it’s the redirect to the realm for logging in).

The correct URL would be https:///keycloak.mydomain.com without the port.

My configuration is:  
ENV KC\_HTTP\_ENABLED=true  
ENV KC\_PROXY\_HEADERS=xforwarded  
ENV KC\_HOSTNAME=https:///keycloak.mydomain.com

I don’t know if I’m missing something or if I need to change something. I’ve really racked my brain trying different things, but I can’t figure it out.

---

<div class="post-metadata">

**Author:** ![xgp](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/xgp/32/2589_2.png) [@xgp](https://forum.keycloak.org/u/xgp)\
**Post date:** [May 25, 2026, 4:07pm UTC](https://forum.keycloak.org/t/redirection-with-aws-alb/31381/2 "2026-05-25T16:07:19Z")

</div>

I’m not sure I 100% understand your question, but here are some suggestions:

1. Check out the documentation on the use of the hostname parameter: [Configuring the hostname (v2) - Keycloak](https://www.keycloak.org/server/hostname)
2. Make sure you’re not actually using 3 backslashes `///` as you posted
3. Try `KC_HOSTNAME=https://keycloak.mydomain.com` and `KC_HOSTNAME_BACKCHANNEL_DYNAMIC=true`

---

<div class="post-metadata">

**Author:** ![SergioCea](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/sergiocea/32/10400_2.png) [@SergioCea](https://forum.keycloak.org/u/SergioCea)\
**Post date:** [May 25, 2026, 5:54pm UTC](https://forum.keycloak.org/t/redirection-with-aws-alb/31381/3 "2026-05-25T17:54:48Z")

</div>

Hello,  
I probably didn’t explain myself very well. The communication between the services is internal and not through the DNS, hence my problems.

I tried setting KC\_HOSTNAME\_STRICT to false and it worked correctly.

Thank you very much.
