We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent d767029 commit 6957a4aCopy full SHA for 6957a4a
1 file changed
middleware/set-fastly-cache-headers.js
@@ -1,7 +1,19 @@
1
const FASTLY_TTL = process.env.FASTLY_TTL || String(60 * 60 * 24) // 24 hours
2
const STALE_TTL = String(60 * 10) // 10 minutes
3
4
+const BYPASS_FASTLY = process.env.TEST_BYPASS_FASTLY === 'true'
5
+const BYPASS_PRODUCTS = /^\/([a-z]{2})\/([a-z0-9._-]+@[a-z0-9._-]+\/)?(discussions|packages|actions)(\/.*|$)/i
6
+
7
module.exports = (req, res, next) => {
8
+ // Test bypassing Fastly for all pages inside of the Discussions product
9
+ if (BYPASS_FASTLY && BYPASS_PRODUCTS.test(req.originalUrl)) {
10
+ res.set({
11
+ 'surrogate-control': 'private, no-store',
12
+ 'cache-control': 'private, no-store'
13
+ })
14
+ return next()
15
+ }
16
17
res.set({
18
19
// Say you want Fastly to cache your content but you don't want it cached by browsers.
0 commit comments