[GH-ISSUE #498] How Remote User Header works #368

Closed
opened 2026-02-25 23:42:12 +03:00 by kerem · 7 comments
Owner

Originally created by @dharmendrakariya on GitHub (Apr 7, 2021).
Original GitHub issue: https://github.com/healthchecks/healthchecks/issues/498

Hi,

I have set remote user header in my helm chart like below.

extraenvs:
      REMOTE_USER_HEADER: "HTTP_X_CUSTOM_CLAIM_EMAIL"

but when I use Postman to send this header(X-Custom-Claim-email: xyz@abc) its not giving the result as expected(not logged in).

when I check by using curl, its showing header is going

curl -H "X-Custom-Claim-email: abc@xyz.dev" https://healthchecks.xyz.dev -v

Originally created by @dharmendrakariya on GitHub (Apr 7, 2021). Original GitHub issue: https://github.com/healthchecks/healthchecks/issues/498 Hi, I have set remote user header in my helm chart like below. ``` extraenvs: REMOTE_USER_HEADER: "HTTP_X_CUSTOM_CLAIM_EMAIL" ``` but when I use Postman to send this header(X-Custom-Claim-email: xyz@abc) its not giving the result as expected(not logged in). when I check by using curl, its showing header is going ``` curl -H "X-Custom-Claim-email: abc@xyz.dev" https://healthchecks.xyz.dev -v```
kerem closed this issue 2026-02-25 23:42:12 +03:00
Author
Owner

@cuu508 commented on GitHub (Apr 7, 2021):

Are you running at least v1.18.0?

I started a dev server like so:

$ REMOTE_USER_HEADER=HTTP_X_CUSTOM_CLAIM_EMAIL ./manage.py runserver

In Firefox, I installed a "Modify Header Value" addon, and configured it to add a X-Custom-Claim-Email header:

image

After doing that, I opened http://localhost:8080 and was logged in:

image

<!-- gh-comment-id:814700807 --> @cuu508 commented on GitHub (Apr 7, 2021): Are you running at least v1.18.0? I started a dev server like so: $ REMOTE_USER_HEADER=HTTP_X_CUSTOM_CLAIM_EMAIL ./manage.py runserver In Firefox, I installed a "Modify Header Value" addon, and configured it to add a X-Custom-Claim-Email header: ![image](https://user-images.githubusercontent.com/661859/113832254-1ac37000-9791-11eb-9d91-09ef8de621cb.png) After doing that, I opened http://localhost:8080 and was logged in: ![image](https://user-images.githubusercontent.com/661859/113832541-60803880-9791-11eb-8dcb-949b86309447.png)
Author
Owner

@cuu508 commented on GitHub (Apr 7, 2021):

Also works in Insomnia (I don't have Postman):

image

<!-- gh-comment-id:814703894 --> @cuu508 commented on GitHub (Apr 7, 2021): Also works in Insomnia (I don't have Postman): ![image](https://user-images.githubusercontent.com/661859/113833191-06cc3e00-9792-11eb-8cb0-2d2c034f065e.png)
Author
Owner

@dharmendrakariya commented on GitHub (Apr 7, 2021):

Are you running at least v1.18.0?

I started a dev server like so:

$ REMOTE_USER_HEADER=HTTP_X_CUSTOM_CLAIM_EMAIL ./manage.py runserver

In Firefox, I installed a "Modify Header Value" addon, and configured it to add a X-Custom-Claim-Email header:

image

After doing that, I opened http://localhost:8080 and was logged in:

image

I am having linuxserver/healthchecks: amd64-version-v1.16.0 does it require at least v1.18.0?

<!-- gh-comment-id:814716148 --> @dharmendrakariya commented on GitHub (Apr 7, 2021): > Are you running at least v1.18.0? > > I started a dev server like so: > > ``` > $ REMOTE_USER_HEADER=HTTP_X_CUSTOM_CLAIM_EMAIL ./manage.py runserver > ``` > > In Firefox, I installed a "Modify Header Value" addon, and configured it to add a X-Custom-Claim-Email header: > > ![image](https://user-images.githubusercontent.com/661859/113832254-1ac37000-9791-11eb-9d91-09ef8de621cb.png) > > After doing that, I opened http://localhost:8080 and was logged in: > > ![image](https://user-images.githubusercontent.com/661859/113832541-60803880-9791-11eb-8dcb-949b86309447.png) I am having ```linuxserver/healthchecks: amd64-version-v1.16.0``` does it require at least v1.18.0?
Author
Owner

@dharmendrakariya commented on GitHub (Apr 7, 2021):

I checked with the latest version and its working fine thanks for the help:)

<!-- gh-comment-id:814727466 --> @dharmendrakariya commented on GitHub (Apr 7, 2021): I checked with the latest version and its working fine thanks for the help:)
Author
Owner

@mikhail5555 commented on GitHub (Sep 17, 2021):

I am sorry to reopen this issue, but i have been stuck with this problem for a while now.
I have been using linuxserver/healthchecks: amd64-version-v1.22.0 and it just am not able to get it working.
I add REMOTE_USER_HEADER = "HTTP_X_CUSTOM_CLAIM_EMAIL" to local_settings.py and send a request containing the X-Custom-Claim-Email header but it doesn't do anything and normal login also stops working.

<!-- gh-comment-id:921789123 --> @mikhail5555 commented on GitHub (Sep 17, 2021): I am sorry to reopen this issue, but i have been stuck with this problem for a while now. I have been using `linuxserver/healthchecks: amd64-version-v1.22.0` and it just am not able to get it working. I add `REMOTE_USER_HEADER = "HTTP_X_CUSTOM_CLAIM_EMAIL"` to local_settings.py and send a request containing the `X-Custom-Claim-Email` header but it doesn't do anything and normal login also stops working.
Author
Owner

@cuu508 commented on GitHub (Sep 17, 2021):

Hi @Mikhail5555 – in settings.py, there is this bit:

REMOTE_USER_HEADER = os.getenv("REMOTE_USER_HEADER")
if REMOTE_USER_HEADER:
    AUTHENTICATION_BACKENDS = ("hc.accounts.backends.CustomHeaderBackend",)

So, if you pass REMOTE_USER_HEADER as environment variable, it adjusts AUTHENTICATION_BACKENDS. But if you define it in local_settings.py, it doesn't – because it imports local_settings.py at the very end.

To fix, try adding this line to local_settings.py:

AUTHENTICATION_BACKENDS = ("hc.accounts.backends.CustomHeaderBackend",)
<!-- gh-comment-id:921797528 --> @cuu508 commented on GitHub (Sep 17, 2021): Hi @Mikhail5555 – in settings.py, there is this bit: ``` REMOTE_USER_HEADER = os.getenv("REMOTE_USER_HEADER") if REMOTE_USER_HEADER: AUTHENTICATION_BACKENDS = ("hc.accounts.backends.CustomHeaderBackend",) ``` So, if you pass REMOTE_USER_HEADER as environment variable, it adjusts AUTHENTICATION_BACKENDS. But if you define it in local_settings.py, it doesn't – because it imports `local_settings.py` at the very end. To fix, try adding this line to `local_settings.py`: ``` AUTHENTICATION_BACKENDS = ("hc.accounts.backends.CustomHeaderBackend",) ```
Author
Owner

@mikhail5555 commented on GitHub (Sep 17, 2021):

Thank you! That indeed solved it!
I though i was going crazy, already spend so much time on trying to get this working. For some reason i though local_settings.py just created an environment variable, but it overwrites the settings.py

<!-- gh-comment-id:921828090 --> @mikhail5555 commented on GitHub (Sep 17, 2021): Thank you! That indeed solved it! I though i was going crazy, already spend so much time on trying to get this working. For some reason i though `local_settings.py` just created an environment variable, but it overwrites the `settings.py`
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/healthchecks#368
No description provided.