@@ -133,7 +133,7 @@ location ~ ^/([a-z-]*/)?(3|3.5|3.6|3.7|3.8|3.9|3.10)/library/_winreg.html$ {
133133location ~ ^/([a-z-]*/)?(3|3.12|3.13|3.14)/library/(asynchat|asyncore|smtpd).html$ {
134134 return 301 https://$host/$1$2/;
135135}
136- location ~ ^/([a-z-]*/)?(3.13|3.14)/library/(2to3|aifc|audioop|cgi|cgitb|chunk|crypt|imghdr|mailcap|msilib|nis|nntplib|ossaudiodev|pipes|sndhdr|spwd|sunau|telnetlib|tkinter.tix|uu|xdrlib).html$ {
136+ location ~ ^/([a-z-]*/)?(3|3 .13|3.14)/library/(2to3|aifc|audioop|cgi|cgitb|chunk|crypt|imghdr|mailcap|msilib|nis|nntplib|ossaudiodev|pipes|sndhdr|spwd|sunau|telnetlib|tkinter.tix|uu|xdrlib).html$ {
137137 return 301 https://$host/$1$2/;
138138}
139139
@@ -167,7 +167,7 @@ location = /documenting/building.html {
167167}
168168
169169# Map toplevel URIs to Python 3 docs.
170- location ~ ^/((archives|c-api|distutils|extending|faq|howto|install|library|reference|tutorial|using|whatsnew|_images|_sources|_static)(/.*)?)$ {
170+ location ~ ^/((archives|c-api|deprecations| distutils|extending|faq|howto|install|library|reference|tutorial|using|whatsnew|_images|_sources|_static)(/.*)?)$ {
171171 return 301 https://$host/3/$1;
172172}
173173location ~ ^/(about|bugs|contents|copyright|download|genindex(-[^.]+)?|glossary|index|license|py-modindex|search)(.html)?$ {
@@ -185,36 +185,46 @@ location ~ ^/((2|3)(\.[0-9]+)?|dev)/\w+/[\d\w\.]+(?!\.html)$ {
185185 if (-f "${request_filename}.html") {
186186 return 301 https://$host:$request_uri.html;
187187 }
188+ add_header Surrogate-Key en/$1 always;
189+ }
190+
191+ # Add the Surrogate-Key for bulk CDN purging
192+ # xref https://docs.fastly.com/en/guides/working-with-surrogate-keys
193+ location ~ ^/((2|3)(\.[0-9]+)?|dev)/ {
194+ add_header Surrogate-Key en/$1 always;
195+ }
196+ location ~ ^/(es|fr|id|it|ja|ko|pl|pt-br|tr|uk|zh-cn|zh-tw)/((2|3)(\.[0-9]+)?|dev)/ {
197+ add_header Surrogate-Key $1/$2 always;
188198}
189199
190200# Map old, 2.5-and-earlier directory names to 2.6-and-later names.
191201location = /lib/ {
192- return 301 https://$host/library/;
202+ return 301 https://$host/3/ library/;
193203}
194204location ~ ^/lib/module-([a-zA-Z0-9.]+)\.html$ {
195- return 301 https://$host/library/$1.html;
205+ return 301 https://$host/3/ library/$1.html;
196206}
197207location = /tut/ {
198- return 301 https://$host/tutorial/;
208+ return 301 https://$host/3/ tutorial/;
199209}
200210location = /tut/tut.html {
201- return 301 https://$host/tutorial/;
211+ return 301 https://$host/3/ tutorial/;
202212}
203213location = /api/ {
204- return 301 https://$host/c-api/;
214+ return 301 https://$host/3/ c-api/;
205215}
206216location = /ext/ {
207- return 301 https://$host/extending/;
217+ return 301 https://$host/3/ extending/;
208218}
209219location = /dist/ {
210- return 301 https://docs.python.org/distutils /;
220+ return 301 https://$host/3 /;
211221}
212222location = /inst/ {
213- return 301 https://$host/install /;
223+ return 301 https://$host/3 /;
214224}
215225location = /doc/ {
216- return 301 https://devguide.python.org/documenting.html ;
226+ return 301 https://devguide.python.org/documentation/start- documenting/ ;
217227}
218228location = /ref/ {
219- return 301 https://$host/reference/;
229+ return 301 https://$host/3/ reference/;
220230}
0 commit comments