Skip to content

Commit 2cf5aa8

Browse files
committed
resolve bug
1 parent 9105d8c commit 2cf5aa8

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

worker.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ export default {
8282

8383
// Read state (cache by default)
8484
let state = await getMaintenanceState(env, host);
85+
const isMaintenance = state.isGlobalMaintenance || state.isSubdomainMaintenance;
8586

8687
// Maintenance control interface (admin) - NO CACHE
8788
if (host === env.MAINTENANCE_DOMAIN && url.pathname === '/') {
@@ -101,8 +102,8 @@ export default {
101102
let response;
102103
try {
103104
response = await fetch(request);
104-
105105
} catch (err) {
106+
// isMaintenance is now always defined above
106107
const redirectResponse = await c_redirect(request, null, err, isMaintenance, env);
107108
if (redirectResponse) return redirectResponse;
108109
return new Response('Upstream unreachable', { status: 502 });

0 commit comments

Comments
 (0)