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

Forced redirect /$rest -> example.com redirects PR previews (external domain) to target domain #9614

Closed
andersy005 opened this issue Sep 21, 2022 · 9 comments · Fixed by #10881

Comments

@andersy005
Copy link

andersy005 commented Sep 21, 2022

Details

Expected Result

Pull Request preview to work when using custom domain.

Actual Result

We recently switched to using a custom domain for our docs on RTD docs.xarray.dev, and this appears to have broken the pull request preview feature (or this doesn't seem to work for us at least). For instance, The GitHub check for this PR: pydata/xarray#7061 points to https://docs.xarray.dev/en/7061/. This page returns a 404

Cc @jhamman

@stsewd
Copy link
Member

stsewd commented Sep 21, 2022

Hi, this looks like a side effect of the exact redirect that the project has in place.

/$rest -> https://docs.xarray.dev/.

That redirect will redirect all requests to the docs.xarray.dev domain, but in this case it should stay in https://xray--7061.org.readthedocs.build/en/7061/, which is the domain for serving PR previews.

One way to solve this would be to create that redirect only for the active versions on https://readthedocs.org/projects/xray/versions/, i.e /latest/$rest -> https://docs.xarray.dev/latest/, /stable/$rest -> https://docs.xarray.dev/stable/, and so on.

Another way would be for us to support matching the domain in the redirect, this is

https:///xarray.readthedocs.io/$rest -> https://docs.xarray.dev/ (it will only redirect for requests on the readthedocs.io domain).

@stsewd
Copy link
Member

stsewd commented Sep 21, 2022

And other solution could be to ignore user redirects when serving PR previews.

@stsewd stsewd changed the title Pull Request Preview not working when using custom domain Forced redirect /$rest -> example.com redirects PR previews (external domain) to target domain Sep 21, 2022
@andersy005
Copy link
Author

andersy005 commented Sep 22, 2022

https://xarray.readthedocs.io/$rest -> https://docs.xarray.dev/ (it will only redirect for requests on the readthedocs.io domain).

this solution appears to be working for us 🎉 . Thank you, @stsewd!

@jhamman
Copy link

jhamman commented Sep 22, 2022

Actually, I'm not sure it is working.

https://xarray.pydata.org/en/stable/api.html is no longer redirecting to https://docs.xarray.dev/en/stable/api.html as expected.

@andersy005
Copy link
Author

xarray.pydata.org/en/stable/api.html is no longer redirecting to docs.xarray.dev/en/stable/api.html as expected.

Good catch... Forgot to check this

@stsewd
Copy link
Member

stsewd commented Sep 22, 2022

https://xarray.readthedocs.io/$rest -> https://docs.xarray.dev/ (it will only redirect for requests on the readthedocs.io domain).

this solution appears to be working for us tada . Thank you, @stsewd!

Sorry, I meant that those solutions we could implement in the future, that's not currently supported.

@stsewd
Copy link
Member

stsewd commented Dec 7, 2023

This will be fixed with #10881. We decided to not run user redirects on previews from PRs, those domains should be treated as temporary.

@humitos
Copy link
Member

humitos commented Jan 3, 2024

We decided to not run user redirects on previews from PRs, those domains should be treated as temporary.

@stsewd do we have this decision documented somewhere? If not, I think it will be good for users and also for ourselves.

@stsewd
Copy link
Member

stsewd commented Jan 3, 2024

We decided to not run user redirects on previews from PRs, those domains should be treated as temporary.

@stsewd do we have this decision documented somewhere? If not, I think it will be good for users and also for ourselves.

It's in the documentation and design document.

https://docs.readthedocs.io/en/latest/user-defined-redirects.html#limitations-and-observations

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 a pull request may close this issue.

4 participants