Skip to content

Commit ad720df

Browse files
committed
add 530 error
1 parent 300ed33 commit ad720df

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

custom-redirect.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,10 @@ function getErrorDetailsFromCfCode(cfCode, env) {
5454
errorType = env.TEXT_BOX_ERROR_TYPE;
5555
errorMessage = env.TEXT_BOX_ERROR_MESSAGE;
5656
errorGif = env.TEXT_BOX_ERROR_GIF;
57+
} else if (env.TEXT_TUNNEL_ERROR_CODE.includes(cfCode)) {
58+
errorType = env.TEXT_TUNNEL_ERROR_TYPE;
59+
errorMessage = env.TEXT_TUNNEL_ERROR_MESSAGE;
60+
errorGif = env.TEXT_TUNNEL_ERROR_GIF;
5761
}
5862
}
5963

@@ -93,6 +97,7 @@ export async function c_redirect(request, response, thrownError = null, isMainte
9397
}
9498

9599
console.log("thrownError:", thrownError);
100+
console.log("thrownError.code:", thrownError.code);
96101
console.log("response.status:", response.status);
97102

98103
// Handle zero trust errors

wrangler.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,11 @@ TEXT_BOX_ERROR_TYPE = "Erreur de connexion"
3636
TEXT_BOX_ERROR_MESSAGE = "On dirait que ma box fibre et 4G ont décidé de faire une pause, <br> il va falloir patienter... 😩 N’hésitez pas à me le signaler quand même !"
3737
TEXT_BOX_ERROR_GIF = "https://raw.githubusercontent.com/JamesDAdams/cloudflare-worker-error-page/refs/heads/main/assets/box_error.gif"
3838

39+
# For 530 errors when the cloudflare tunnel doesn work ONLY FOR ZERO TRUST USER
40+
TEXT_TUNNEL_ERROR_CODE = [530]
41+
TEXT_TUNNEL_ERROR_TYPE = "Erreur Zero Trust"
42+
TEXT_TUNNEL_ERROR_MESSAGE = "On dirait qu'il y a un soucis avec le tunnel cloudflare Zero Trust... <br> N'hésitez pas à me le signaler !"
43+
TEXT_TUNNEL_ERROR_GIF = "https://raw.githubusercontent.com/JamesDAdams/cloudflare-worker-error-page/refs/heads/main/assets/box_error.gif"
3944

4045
# For 502 errors when a service is down
4146
TEXT_CONTAINER_ERROR_CODE = [502, 503]

0 commit comments

Comments
 (0)