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

Use Surrogate-Key headers for docs.python.org #510

Merged
merged 2 commits into from
Oct 9, 2024

Conversation

AA-Turner
Copy link
Member

Closes #287.

A

Comment on lines +191 to +197
# 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;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally I had hoped to use some sort of non-binding match construct to add the headers, but it seems that NGINX location directives will always bind. The end goal is simply to add some unique prefix for every second level path (and English) that we can use to purge. I think the approach here is fine given every other rule here is a redirect, but worth pointing out.

Fastly has some text about adding surrogate keys via vcl_fetch, but I don't know where I'd configure that.

A

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be configured in our Fastly service for docs.python.org, but is probably more scrutable (and testable, nice!) here.

@JacobCoffee JacobCoffee merged commit 3152de3 into python:main Oct 9, 2024
3 checks passed
@AA-Turner AA-Turner deleted the surrogate-keys branch October 9, 2024 20:18
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.

Add some VCL to fastly so docs can be purged by top or 2nd level folder
3 participants