Skip to content

Set Cache-Control to no-store on paths containing %2F/%5C/%2E - #2018

Open
svpernova09 wants to merge 1 commit into
php:masterfrom
svpernova09:cdn-cache-poisoning-workaround
Open

svpernova09 wants to merge 1 commit into
php:masterfrom
svpernova09:cdn-cache-poisoning-workaround

Conversation

@svpernova09

Copy link
Copy Markdown
Contributor

We currently have a CDN issue that can poison our caches because of how the CDN creates cache keys from paths, resulting in / on www.php.net being cached as a redirect.

This patch catches those requests and sets Cache-Control: no-store header so they won't be cached, but other legitimate redirects or 404s will be.

Once this lands and is tested, we can remove the current workaround edge rules, which set cache time to 0 on all 301, 302, and 404 response codes.

I have opened a support ticket with Bunny to address the issue.

@github-actions

Copy link
Copy Markdown
Contributor

📊 Regression report for commit 5384982 is at https://web-php-regression-report-pr-2018.preview.thephp.foundation

@github-actions

Copy link
Copy Markdown
Contributor

🚀 Preview for commit 5384982 is available at https://web-php-pr-2018.preview.thephp.foundation

Comment thread include/prepend.inc
header('Cache-Control: no-store');
});
}
})();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I don't understand why there is a closure here that you then need to execute immediately, nor why the header_register is there, considering that literally the next line in the code also sets a header.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It was an attempt at encapsulation, and I went a bit overboard.

We shouldn't need this change if Bunny resolves the issue on their side. According to the support ticket, they've escalated it on their side, so this PR can wait until we see the outcome before moving forward.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants