-
-
Notifications
You must be signed in to change notification settings - Fork 58
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
Redirect full version archive files to {major}.{minor}
#498
Conversation
# Map archive URLs to {major}.{minor} | ||
location ~ ^/([a-z-]*/)?(3|3.12|3.13|3.14)/archives/python-(3.12|3.13|3.14)\.\d+((a|b|rc)\d)?-docs(-(html|pdf-a4|pdf-letter|texinfo|text)\.(zip|tar\.bz2)|\.epub)$ { | ||
return 301 https://$host/$1$2/archives/python-$3-docs$6; | ||
} |
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.
This might be clearer?:
cc @JacobCoffee -- I don't know if you have or know of any guidance on best formatting for these redirect rules.
# Map archive URLs to {major}.{minor} | |
location ~ ^/([a-z-]*/)?(3|3.12|3.13|3.14)/archives/python-(3.12|3.13|3.14)\.\d+((a|b|rc)\d)?-docs(-(html|pdf-a4|pdf-letter|texinfo|text)\.(zip|tar\.bz2)|\.epub)$ { | |
return 301 https://$host/$1$2/archives/python-$3-docs$6; | |
} | |
# Map archive URLs to {major}.{minor} | |
location ~ ^/([a-z-]*/)?(3|3.12|3.13|3.14)/archives/python-(3.12|3.13|3.14)\.\d+((a|b|rc)\d)?-docs-(html|pdf-a4|pdf-letter|texinfo|text)\.(zip|tar\.bz2)$ { | |
return 301 https://$host/$1$2/archives/python-$3-docs-$6.$7; | |
} | |
location ~ ^/([a-z-]*/)?(3|3.12|3.13|3.14)/archives/python-(3.12|3.13|3.14)\.\d+((a|b|rc)\d)?-docs\.epub$ { | |
return 301 https://$host/$1$2/archives/python-$3-docs.epub; | |
} |
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.
given the nature of the capture groups i think there isnt much formatting that could save us! it looks pretty good to me, imo
I do think the separation for epub just adds a whole bunch of duplication and could still sit on the original single location block with the rest... but maybe @ewdurbin has more insight
For the sake of understanding... Can you give a few explicit examples of what the redirects desired are? I'm having a hard time working backward from the regex |
The full list of expected filenames is in the opening post, redirecting a A |
Are these redirects effective if the original URL is not found as a file? |
The redirects are always active regardless of the filesystem -- the issue is that an archive called "3.X.Y" is not the same as the documentation at time of Python 3.X.Y's release. It is simpler to explain when we just present the archives for Python 3.X, and state that they're the current state of the branch -- to get versioned archives, use https://docs.python.org/release/. A |
1677ed4
to
2479524
Compare
)" This reverts commit 355ffe5.
This aims to redirect archive URLs with full release versions to
{major}.{minor}
:python-{release}-docs-html.tar.bz2
python-{release}-docs-html.zip
python-{release}-docs-pdf-a4.tar.bz2
python-{release}-docs-pdf-a4.zip
python-{release}-docs-pdf-letter.tar.bz2
python-{release}-docs-pdf-letter.zip
python-{release}-docs-texinfo.tar.bz2
python-{release}-docs-texinfo.zip
python-{release}-docs-text.tar.bz2
python-{release}-docs-text.zip
python-{release}-docs.epub
[Edit 26/Sep 18:00 BST -- the new format files are now built on 3.12 and 3.14 for all languages, and 3.13 for English with translations in progress currently (should take ~9 hours), so this can be merged tomorrow at the earliest]
A