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

Proxito: move "canonicalizing" logic to docs view #10027

Merged
merged 4 commits into from
Feb 16, 2023

Conversation

stsewd
Copy link
Member

@stsewd stsewd commented Feb 14, 2023

This only applies to doc serving, so no need to have it at the middleware level, unless we want to enforce this for all views.

This only applies to doc serving, so no need to have it
at the middleware level, unless we want to enforce this
for all views.
@stsewd stsewd requested a review from a team as a code owner February 14, 2023 21:55
@stsewd stsewd requested a review from humitos February 14, 2023 21:55
Copy link
Member

@humitos humitos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me! I left some questions and comments.

self.assertEqual(request.canonicalize, 'noncanonical-cname')
resp = self.client.get(self.url, HTTP_HOST=cname)
self.assertEqual(resp.status_code, 302)
self.assertEqual(resp["X-RTD-Redirect"], "noncanonical-cname")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we create a RedirectType.to_non_canonical_domain and use it here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We aren't setting that value from anywhere, this test is marked as fail too. This looks like a feature we wanted to implement at some point, I'm +1 on just deleting these tests.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Requests to a custom domain should redirect to the public domain or canonical domain if not canonical.

I guess that's when users don't have any custom domain set as canonical we want to redirect to the public domain?

@ericholscher may have more information about this "lost feature"

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#6905 (comment) I think is the conversation. I think it's mostly just awkward to redirect people away from custom domains. There are use cases where people might want to have docs on a custom domain, but not have it be canonical.

So I'm +1 on deleting this I think.

readthedocs/proxito/views/mixins.py Show resolved Hide resolved
readthedocs/proxito/views/serve.py Show resolved Hide resolved
@stsewd
Copy link
Member Author

stsewd commented Feb 16, 2023

I'm merging this now, but @ericholscher if you have some insight about #10027 (comment), so we can remove those tests or open a new issue for that feature if needed.

@stsewd stsewd merged commit c18bd6f into main Feb 16, 2023
@stsewd stsewd deleted the move-canonica-redirect-to-doc-serving-view branch February 16, 2023 22:34
stsewd added a commit that referenced this pull request Feb 27, 2023
stsewd added a commit that referenced this pull request Mar 2, 2023
@stsewd stsewd mentioned this pull request Mar 2, 2023
stsewd added a commit that referenced this pull request Mar 2, 2023
stsewd added a commit that referenced this pull request Mar 2, 2023
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

Successfully merging this pull request may close these issues.

3 participants