I’m using Apache with mod_auth_kerb to perform HTTP authentication. How do I add custom headers to the 401 Authorization Required response generated by the auth module?

The relevant section of my Apache configuration is below. My custom header is being added after the Require valid-user check passes but is ignored on the initial request when the browser doesn’t send credentials and the server generates the 401 response.

Require valid-user
AuthType Kerberos
AuthName “App Login”

Header always set X-My-Header my-value

Read more here: Add custom headers to HTTP 401 responses from Kerberos mod_auth_kerb


If you know the solution of this issue, please leave us a reply in Comment section, to update the question.

Wordpress related questions and answers: