Skip to content
This repository has been archived by the owner on Jun 12, 2024. It is now read-only.

HTTP auth/redirect for hosted solution on Azure App Service does not prefix with HTTPS #5

Open
ghost opened this issue Nov 19, 2021 · 4 comments

Comments

@ghost
Copy link

ghost commented Nov 19, 2021

Please provide us with the following information:

This issue is for a: (mark with an x)

- [ ] bug report -> please search issues before submitting
- [ ] feature request
- [ ] documentation issue or request
- [ ] regression (a behavior that used to work and stopped in a new release)

Minimal steps to reproduce

Any log messages given by the failure

Expected/desired behavior

OS and Version?

Windows 7, 8 or 10. Linux (which distribution). macOS (Yosemite? El Capitan? Sierra?)

Versions

Mention any other details that might be useful


Thanks! We'll be in touch soon.

@amber-qian
Copy link

this app works fine on my local, after I deploy it to Azure, the redirect_uri doesn't have https prefix, and I received error:
https://django-aad.azurewebsites.net/auth/redirect?error=redirect_uri_mismatch&error_description=AADB2C90006: The redirect URI 'http://django-aad.azurewebsites.net/auth/redirect' provided in the request is not registered for the client id '5dbf6851-dffa-4b11-abee-2151a8e8625d'.
Correlation ID: 85fbdbfa-da14-4d26-a170-1361b296f5f4
Timestamp: 2022-06-06 23:09:22Z
&state=b88a02b0-a2fa-4618-85e3-17032bf2145b

image

@NovaFly
Copy link

NovaFly commented Aug 18, 2022

I also met this problem when I tried deploy it in our cloud environment, any idea with this issue?

@NZLostboy
Copy link

I haven't solved this yet, but this sounds like the issue AzureAD/microsoft-identity-web#115

@NZLostboy
Copy link

Fix is here: https://stackoverflow.com/questions/66977121/azure-ad-redirect-uri-changes-from-https-to-http

TLDR; Add these to settings.py:

SECURE_SSL_REDIRECT = True 

SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')

I am not sure if the fix is something that belongs with this project or not, it works fine as long as you aren't trying to deploy it in Azure App Services or using a front facing proxy. Seems like a large number of people are getting trapped with this though

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants