-
Notifications
You must be signed in to change notification settings - Fork 16
Add flag to optionally limit redirects to url_prefix #155
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
base: main
Are you sure you want to change the base?
Conversation
|
conflicts with main now |
| "</tr>" | ||
| "<tr>" | ||
| "<td>/docs/other/path</td>" | ||
| "<td>/scod/cooler-place</td>" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't you want to be including this target in an assert?
| api=discourse_api, | ||
| index_topic_id=1, | ||
| url_prefix="/", | ||
| limit_redirects_to_url_prefix=False, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have a few wonderings:
- Should a limit on redirect targets perhaps be the default behaviour for all documentation?
- Or, would this be better as a
redirect_prefixsetting, so you can set the allowed prefix? - Or should we combine the two, with the default being restrictive but overrideable with a different prefix?
Really the only way to answer this is to do a quick audit of what sorts of redirects currently exist within documentation sets. Do people actually redirect out of the domain, or out of the docs area, in practice?
anthonydillon
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Lukewh can you rebase this one please?
| warnings.append( | ||
| ( | ||
| f"Redirect map location {location} " | ||
| f"is blocked by same prefix constraint" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it same prefix or same origin?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same prefix, e.g. "/docs"
|
I'll fix the tests later - looks like I need to update new ones |
|
@Lukewh is this still valid? |
Done
By default, redirects are very restrictive, this change makes things more open by default, which is fine in 99% of our use-cases.
QA
/docs/test->/docs/docs/test->https://github.comurl_prefix="/docs":limit_redirects_to_url_prefixset toTrueredirect 1. should work and redirect 2. should not.limit_redirects_to_url_prefixunset (or set toFalse), both redirects should workFixes https://warthogs.atlassian.net/browse/WD-2871