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

Serve repodata.json with redirect #506

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

jonashaag
Copy link

Using a redirect is faster than streaming it through the Quetz instance.


# Redirect response
if (is_package_request or is_repodata_request) and pkgstore.support_redirect:
return RedirectResponse(
Copy link
Member

Choose a reason for hiding this comment

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

did you confirm that this works? Since it redirects to a path with .gz attached and I am not sure mamba / conda will handle that correctly.

Copy link
Author

Choose a reason for hiding this comment

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

You are probably right, will have to do more testing. I should have done more testing because I've also found two other issues. One is that Conda sets Content-Type: json which doesn't work with the GCS signature (I assume you need to sign all the request headers as well, not just the URL?). Plus, if a file is not found, the client will get a 403 from GCS although it would be more helpful to receive a 404.

@jonashaag
Copy link
Author

@wolfv works now. We still get a 403 instead of a 404 but I guess that's difficult to solve without adding a file-exists check before the redirect (which would be costly)

self, channel: str, src: str, expires=3600, content_type: Optional[str] = None
):
if content_type is not None:
raise NotImplementedError("'content_type' is not supported for S3")
Copy link
Author

Choose a reason for hiding this comment

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

TODO: Check what to do with S3. I am not sure if S3 will happily accept non-signed headers or will error out (in the latter case we can't use redirects for repodata.json on S3)

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.

2 participants