# Add Custom Header to Authentication Requests?

**URL:** <https://forum.keycloak.org/t/add-custom-header-to-authentication-requests/31098>\
**Category:** Getting advice\
**Tags:** authentication\
**Created:** [September 10, 2025, 2:49pm UTC](https://forum.keycloak.org/t/add-custom-header-to-authentication-requests/31098 "2025-09-10T14:49:31Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![red-drover](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/red-drover/32/11606_2.png) [@red-drover](https://forum.keycloak.org/u/red-drover)\
**Post date:** [September 10, 2025, 2:49pm UTC](https://forum.keycloak.org/t/add-custom-header-to-authentication-requests/31098/1 "2025-09-10T14:49:31Z")

</div>

Is there an easy way to update a response header based on the authentication status of a user? Example: failed login already shows to the client as it is known information. Can Keycloak set a header based on that event?

---

<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:** [September 10, 2025, 4:58pm UTC](https://forum.keycloak.org/t/add-custom-header-to-authentication-requests/31098/2 "2025-09-10T16:58:25Z")

</div>

If you are building a custom authentication flow, you can create a custom Authenticator that sets a response header.

Look here for more documentation [Server Developer Guide](https://www.keycloak.org/docs/latest/server_development/index.html#_auth_spi_walkthrough)

---

<div class="post-metadata">

**Author:** ![red-drover](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/red-drover/32/11606_2.png) [@red-drover](https://forum.keycloak.org/u/red-drover)\
**Post date:** [September 10, 2025, 5:13pm UTC](https://forum.keycloak.org/t/add-custom-header-to-authentication-requests/31098/3 "2025-09-10T17:13:22Z")

</div>

As in the only way to do this is with a custom extension?

---

<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:** [September 10, 2025, 5:15pm UTC](https://forum.keycloak.org/t/add-custom-header-to-authentication-requests/31098/4 "2025-09-10T17:15:38Z")

</div>

As far as I know, yes.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/free1/uploads/keycloak/original/1X/eb342909d95cf32cbb7517610022c6a0046a9ffb.png) [@system](https://forum.keycloak.org/u/system)\
**Post date:** [March 9, 2026, 5:16pm UTC](https://forum.keycloak.org/t/add-custom-header-to-authentication-requests/31098/5 "2026-03-09T17:16:10Z")

</div>

Closed on March 9, 2026, 5:16pm UTC

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.
