Skip to content

Proxito: inactive versions produce infinite redirect when the HTML exists in the storage #9335

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

Closed
humitos opened this issue Jun 15, 2022 · 7 comments
Labels
Accepted Accepted issue on our roadmap Bug A bug

Comments

@humitos
Copy link
Member

humitos commented Jun 15, 2022

It seems that when a version is active=False but its HTML files exist in the storage, we get an infinite redirect:

$ curl -IL http://docs.reprozip.org/en/0.6.1/
...
curl: (47) Maximum (50) redirects followed

El Proxito should return 404 in these situations.

Reference: https://twitter.com/remram44/status/1536882673821655040
Reference: https://github.com/readthedocs/readthedocs-ops/issues/1139
Reference: #9109

@humitos humitos added Bug A bug Accepted Accepted issue on our roadmap labels Jun 15, 2022
@stsewd
Copy link
Member

stsewd commented Jun 15, 2022

This also looks like we failed to remove the files from storage when the version was inactivated.

@humitos
Copy link
Member Author

humitos commented Jun 15, 2022

Yeah, we have a lot of these. They are different problems, tho, and I think we should fix both. However, I'm sure there will be always situations where we fail to delete an inactive version from the storage.

@stsewd
Copy link
Member

stsewd commented Aug 9, 2022

Looks like we are deleting files when the version is deactivated from the form, but not from the API.

if form.has_changed():
if 'active' in form.changed_data and version.active is False:
log.info(
'Removing files for version.',
version_slug=version.slug,
)
clean_project_resources(
version.project,
version,
)
version.built = False
version.save()

Also, we should probably always call the delete function if the version isn't active without checking if the form has changed (just in case the deletion failed, users can just press save).

Also, wonder if we could move this to the save method, but maybe we didn't put it there since it's called too many times (even for an inactive version)?

@domdfcoding
Copy link

Presumably related to this issue, I'm seeing an endless redirect for epub download urls:

$ curl -L https://domdf-python-tools.readthedocs.io/_/downloads/en/stable/epub/
curl: (47) Maximum (50) redirects followed

For this project I only have HTML and PDF builds enabled. PDF URL works fine. This project used to have epub builds enabled, but the problem still presents itself for projects where they were disabled from the beginning.

@humitos
Copy link
Member Author

humitos commented Jan 24, 2023

Related to #9468

@stsewd
Copy link
Member

stsewd commented Apr 3, 2023

With #10153, this shouldn't happen anymore. Previously we were raising a 404 (inactive version), then our 404 handler would see that there is an index file and redirect again to the same path (index file redirect).

Now we check that the URL already ends with / and skip the check for the index file.

But we are missing deleting the files from a version when it's deactivated from the API #9335 (comment).

@stsewd
Copy link
Member

stsewd commented Apr 3, 2023

Closing this in favor of #10221, since the original problem is solved.

@stsewd stsewd closed this as completed Apr 3, 2023
@github-project-automation github-project-automation bot moved this from Planned to Done in 📍Roadmap Apr 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Accepted Accepted issue on our roadmap Bug A bug
Projects
Archived in project
Development

No branches or pull requests

3 participants