-
Notifications
You must be signed in to change notification settings - Fork 76
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
base: main
Are you sure you want to change the base?
Conversation
|
||
# Redirect response | ||
if (is_package_request or is_repodata_request) and pkgstore.support_redirect: | ||
return RedirectResponse( |
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.
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.
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.
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.
@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") |
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.
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)
Using a redirect is faster than streaming it through the Quetz instance.