Skip to content

Commit

Permalink
Use Surrogate-Key headers for docs.python.org
Browse files Browse the repository at this point in the history
  • Loading branch information
AA-Turner committed Oct 9, 2024
1 parent a45ca9a commit 26750c9
Show file tree
Hide file tree
Showing 2 changed files with 666 additions and 0 deletions.
10 changes: 10 additions & 0 deletions salt/docs/config/nginx.docs-redirects.conf
Original file line number Diff line number Diff line change
Expand Up @@ -182,11 +182,21 @@ location ~ ^/(searchindex.js|objects.inv)$ {
# Redirect ``$request_uri`` -> ``$request_uri.html``,
# where the latter is a valid webpage.
location ~ ^/((2|3)(\.[0-9]+)?|dev)/\w+/[\d\w\.]+(?!\.html)$ {
add_header Surrogate-Key en/$1 always;
if (-f "${request_filename}.html") {
return 301 https://$host:$request_uri.html;
}
}

# Add the Surrogate-Key for bulk CDN purging
# xref https://docs.fastly.com/en/guides/working-with-surrogate-keys
location ~ ^/((2|3)(\.[0-9]+)?|dev)/ {
add_header Surrogate-Key en/$1 always;
}
location ~ ^/(es|fr|id|it|ja|ko|pl|pt-br|tr|uk|zh-cn|zh-tw)/((2|3)(\.[0-9]+)?|dev)/ {
add_header Surrogate-Key $1/$2 always;
}

# Map old, 2.5-and-earlier directory names to 2.6-and-later names.
location = /lib/ {
return 301 https://$host/library/;
Expand Down
Loading

0 comments on commit 26750c9

Please sign in to comment.