-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Proxito: refactor canonical redirects #10069
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
Conversation
e368e05
to
00ec8fb
Compare
00ec8fb
to
1ab1759
Compare
Nice! |
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.
This is exciting too! Lots more comments, because I haven't looked through this refactor as much before, so sorry about that.
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.
Looks close!
Would this refactor be compatible with the resolution of this issue? #9988
use_custom_domain = self._use_cname(canonical_project) | ||
custom_domain = canonical_project.get_canonical_custom_domain() |
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.
What about overriding .get_canonical_custom_domain()
instead? Would that be doable and simpler?
Logic around redirects won't change, or at least in a way that breaks the current expected behavior. Canonical redirects always were first, user redirects were second. |
This should be ready for another round of review, added a glossary of the terms we use for each URL part at https://github.com/readthedocs/readthedocs.org/pull/10069/files#diff-92614ae090281fddaae958813072070fe6fe35b6491babadaab557c05898b8ab. |
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.
👍🏼
@@ -648,6 +649,17 @@ def proxied_static_path(self): | |||
"""Path for static files hosted on the user's doc domain.""" | |||
return f"{self.proxied_api_host}/static/" | |||
|
|||
@property | |||
def custom_path_prefix(self): |
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 feel these name changes a lot easier to read and follow 👍🏼
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.
Naming is hard :)
@@ -5,6 +5,41 @@ Module in charge of serving documentation pages. | |||
|
|||
Read the Docs core team members can view the `Proxito design doc <https://github.com/readthedocs/el-proxito/blob/master/docs/design/architecture.rst>`_ | |||
|
|||
URL parts |
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.
This is a really good start! 💯
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.
Agreed, really happy to see this.
readthedocs/proxito/README.rst
Outdated
URL | ||
|------------------------------------------------| | ||
path | ||
|---------------------| | ||
https://docs.readthedocs.io/en/latest/index.html | ||
|-------|-------------------|--|------|----------| | ||
protocol | | | | | ||
domain | | | | ||
language | | | ||
version | | ||
filename |
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.
💯
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.
This is great. Though this is varying a bit from urlparse in some ways which make sense, but we should be explicit if we don't care about the other parts (eg. query
& fragment
).
urlparse("scheme://netloc/path;parameters?query#fragment")
https://docs.python.org/3/library/urllib.parse.html#urllib.parse.urlparse
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.
Agreed this looks really good! 🎉
readthedocs/proxito/README.rst
Outdated
URL | ||
|------------------------------------------------| | ||
path | ||
|---------------------| | ||
https://docs.readthedocs.io/en/latest/index.html | ||
|-------|-------------------|--|------|----------| | ||
protocol | | | | | ||
domain | | | | ||
language | | | ||
version | | ||
filename |
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.
This is great. Though this is varying a bit from urlparse in some ways which make sense, but we should be explicit if we don't care about the other parts (eg. query
& fragment
).
urlparse("scheme://netloc/path;parameters?query#fragment")
https://docs.python.org/3/library/urllib.parse.html#urllib.parse.urlparse
Implementing the plan from #10065.
Closes #10065