We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents b77b3ad + 97ea93e commit ec2bd35Copy full SHA for ec2bd35
1 file changed
functions/_middleware.js
@@ -0,0 +1,20 @@
1
+export async function onRequest(context) {
2
+ const { env, next } = context;
3
+
4
+ const IS_DEPRECATED = env.DEPRECATED !== 'false';
5
6
+ if (IS_DEPRECATED) {
7
+ return new Response(
8
+ 'This site has been deprecated. Please use main-site.',
9
+ {
10
+ status: 410,
11
+ headers: {
12
+ 'Content-Type': 'text/plain; charset=utf-8',
13
+ 'Cache-Control': 'no-store',
14
+ },
15
+ }
16
+ );
17
18
19
+ return await next();
20
+}
0 commit comments