Keycloak Redirect URL wrong when behind Reverse Proxy #8731

Closed
opened 2025-12-29 20:40:31 +01:00 by adam · 2 comments
Owner

Originally created by @hubermi on GitHub (Oct 10, 2023).

NetBox version

v3.6.3

Python version

3.8

Steps to Reproduce

  1. We have a reverse proxy listening for https://netbox.company.de, upstream is https://netbox.intranet.company.de
  2. Netbox is behind an additional reverse proxy (for ssl termination) listening for https://netbox.intranet.company.de
  3. Netbox is configured for Keycloak SSO with SOCIAL_AUTH
  4. Login with Keycloak

Expected Behavior

I should be redirected to https://netbox.company.de/oauth/complete/keycloak and afterwards be logged in.

Observed Behavior

I am redirected to https://netbox.intranet.company.de/oauth/complete/keycloak and the following error message appears:

<class 'social_core.exceptions.AuthStateMissing'>

Session value state missing.

Python version: 3.11.4
NetBox version: v3.6.3
Plugins: None installed

When I manually remove the "intranet." from the URL it works and I am logged in.

Originally created by @hubermi on GitHub (Oct 10, 2023). ### NetBox version v3.6.3 ### Python version 3.8 ### Steps to Reproduce 1. We have a reverse proxy listening for https://netbox.company.de, upstream is https://netbox.intranet.company.de 2. Netbox is behind an additional reverse proxy (for ssl termination) listening for https://netbox.intranet.company.de 3. Netbox is configured for Keycloak SSO with SOCIAL_AUTH 4. Login with Keycloak ### Expected Behavior I should be redirected to https://netbox.company.de/oauth/complete/keycloak and afterwards be logged in. ### Observed Behavior I am redirected to https://netbox.intranet.company.de/oauth/complete/keycloak and the following error message appears: <class 'social_core.exceptions.AuthStateMissing'> Session value state missing. Python version: 3.11.4 NetBox version: v3.6.3 Plugins: None installed When I manually remove the "intranet." from the URL it works and I am logged in.
adam closed this issue 2025-12-29 20:40:31 +01:00
Author
Owner

@DanSheps commented on GitHub (Oct 11, 2023):

This is either a nginx/apache proxy misconfiguration or a Keycloak issue. NetBox simply uses django-social-auth as-is. You should instead take this upstream to the django-social-auth repository and report it there if it is in-fact not an issue with nginx/apache.

@DanSheps commented on GitHub (Oct 11, 2023): This is either a nginx/apache proxy misconfiguration or a Keycloak issue. NetBox simply uses django-social-auth as-is. You should instead take this upstream to the [django-social-auth ](https://github.com/python-social-auth/social-app-django) repository and report it there if it is in-fact not an issue with nginx/apache.
Author
Owner

@DanSheps commented on GitHub (Oct 11, 2023):

Thank you for opening a bug report. This bug appears to be related to a misconfiguration of NetBox or an issue with an upstream library that NetBox uses.

Please review your configuration and if the issue persists open an issue in the upstream libraries repository.

@DanSheps commented on GitHub (Oct 11, 2023): Thank you for opening a bug report. This bug appears to be related to a misconfiguration of NetBox or an issue with an upstream library that NetBox uses. Please review your configuration and if the issue persists open an issue in the upstream libraries repository.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#8731