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

[feat] Add trailing slash to package directory links at root index #10

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

rpatterson
Copy link

This is useful, for example, with nginx proxy configurations, such as using the
ngx_aws_auth module, where directory paths can't be detected by the server.

Python 3.7 is pretty widely available as the default Python 3 while 3.6 is pretty hard
to find these days.  For example, 3.6 isn't even available in the deadsnakes repository
from Ubuntu cosmic on (eoan is current).
This is useful, for example, with nginx proxy configurations, such as using the
`ngx_aws_auth` module, where directory paths can't be detected by the server.
@naiquevin
Copy link
Contributor

Hi, @rpatterson. Can you please share your nginx config? Not sure I understand the problem correctly. We are also using the ngx_aws_auth and haven't faced any issue with trailing slashes. We have a blog post explaining our approach here - https://medium.com/helpshift-engineering/private-python-package-index-with-zero-hassle-6164e3831208

@rpatterson
Copy link
Author

rpatterson commented May 5, 2020

I've moved onto another approach, so the nginx config isn't easy for me to get ATM. I might be able to dig it up, but let me clarify from memory and see if that is enough for you.

The issue that this fixed is if I visited the root /simple/ PyPI index URL that lists all the packages in the index. The packages there should link to the package-specific URL that lists the available versions and dists. The root /simple/index.html generated by this package linked each package to a URL without a trailing slash, /simple/foo-package. But since nginx is proxying to S3 and has no insight into the type of resource available at a given path without a trailing slash, it would just proxy that request onto S3 which would accurately reply that the path wasn't a key for an S3 object.

This isn't an issue for pip since it goes straight to /simple/foo-package/ but I just thought the links in the generated /simple/index.html should work as well should anyone ever browser their own private PyPI in the browser.

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