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

APPEND_SLASH alters both request urls and target resources #1610

Closed
jbazik opened this issue Jan 23, 2013 · 2 comments
Closed

APPEND_SLASH alters both request urls and target resources #1610

jbazik opened this issue Jan 23, 2013 · 2 comments
Milestone

Comments

@jbazik
Copy link
Contributor

jbazik commented Jan 23, 2013

APPEND_SLASH does double duty. It generates redirects for requests lacking a trailing slash. It also adds a slash to target urls. That's often what you want, but it makes it impossible to handle those redirects upstream.

So, in my case, I have a site that I want to resolve only slash-appended urls (for seo). But I want to handle redirects upstream (in a reverse proxy), so I set APPEND_SLASH=False. With that setting, non-slash-appended requests to cms pages resolve, instead of generating a 404. (Why do I want to do that? I want to fall back to an alternate site if the page does not exist in the cms).

In urls.py and util/urlutils.py, there are tests for APPEND_SLASH that add the slash.

I'd suggest separating those settings, so that

APPEND_SLASH - only controls redirects from middleware
REQUIRE_SLASH - sets url policy for the cms

To keep things backward-compatible, make the default

REQUIRE_SLASH=APPEND_SLASH

John

@jbazik
Copy link
Contributor Author

jbazik commented Jan 23, 2013

I guess that should be CMS_REQUIRE_SLASH.

@digi604
Copy link
Contributor

digi604 commented Jan 23, 2013

Hi John,

The AppendSlash settings is very poorly tested, as it is used by very few users. I would accept a Pull Request for this. If you could find the time to write a test for this as well you would be my hero :)

@digi604 digi604 added this to the Some Day milestone Feb 10, 2014
@FinalAngel FinalAngel modified the milestones: Clean up issues & pull requests, Some day Oct 19, 2015
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

3 participants