Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Public named URLs don't work with Django's script prefix #52

Open
SunilMohanAdapa opened this issue Aug 11, 2016 · 0 comments
Open

Public named URLs don't work with Django's script prefix #52

SunilMohanAdapa opened this issue Aug 11, 2016 · 0 comments

Comments

@SunilMohanAdapa
Copy link
Contributor

In Django 1.10, when using django_setup(set_prefix=True) and FORCED_SCRIPT_PREFIX, public named URLs do not work and login URLs lead to infinite redirects.

Stronghold during load time is reverse()ing all the URLs from STRONGHOLD_PUBLIC_NAMED_URLS and storing them as public URLs. Then, in the middleware it compares them with request.path_info to determine if the current URL being requested is a public URL.

With Django 1.10, a new parameter to django.setup() was introduced to make FORCE_SCRIPT_PREFIX applicable outside the requests. So, when reverse() is called outside a request such during the loading of the stronghold conf.py, now, it takes into account FORCE_SCRIPT_PREFIX. Also, request.path_info means path without the script prefix. So, the reversed URLs contain script prefix and the compared value request.path_info does not have script prefix. So, they never match and are not treated as public URLs.

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

No branches or pull requests

1 participant