Closed alexandrud closed 4 months ago
The netbox app had USE_X_FORWARDED_HOST = True
. I changed that to "False" and set proxy_set_header Host $host;
in nginx. That made netbox/social-core compute the proper redirect_uri.
To be more precise, for the nginx ingress in kubernetes I added the following annotations:
ingress:
enabled: true
className: "ingress-nginx"
annotations:
nginx.ingress.kubernetes.io/backend-protocol: HTTP
nginx.ingress.kubernetes.io/upstream-vhost: host.example.com # cloudfront host
nginx.ingress.kubernetes.io/configuration-snippet: |
proxy_set_header Host $host;
hosts:
- host: internalhost.example.com # nginx NLB
paths:
- path: /netbox
pathType: ImplementationSpecific
tls: []
Expected behaviour
Ability to override redirect_uri via environment variable.
Actual behaviour
In my case I have an application in kubernetes behind an nginx that is behind a cloudfront. The redirect URI should be the domain name for the cloudfront distribution. Instead it gets the domain name for the nginx load balancer. I have no control on the infrastructure. I'd like to be able to override the redirect_uri parameter sent by social core.
I've found this issue https://github.com/python-social-auth/social-app-django/issues/31, but I can't quite figure how I can override it.
Tried injecting the env vars: SERVER_NAME / HTTP_HOST at runtime, but they have no effect.