Skip to content

Commit

Permalink
Use Surrogate-Key headers for docs.python.org (#510)
Browse files Browse the repository at this point in the history
* Use Surrogate-Key headers for docs.python.org

* Add header only if content-negotiation emulation fails
  • Loading branch information
AA-Turner authored Oct 9, 2024
1 parent a45ca9a commit 3152de3
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 @@ -185,6 +185,16 @@ location ~ ^/((2|3)(\.[0-9]+)?|dev)/\w+/[\d\w\.]+(?!\.html)$ {
if (-f "${request_filename}.html") {
return 301 https://$host:$request_uri.html;
}
add_header Surrogate-Key en/$1 always;
}

# 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.
Expand Down
Loading

0 comments on commit 3152de3

Please sign in to comment.