Skip to content

Commit d43dc1e

Browse files
committed
Merge branch 'main' of https://github.com/flipt-io/docs
* 'main' of https://github.com/flipt-io/docs: Fix cloudflare redirect loop (#368)
2 parents 192e4ec + 291d197 commit d43dc1e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

worker/src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ export default {
1010
const normalizedPath =
1111
pathname === "/" ? pathname : pathname.replace(/\/$/, "");
1212

13-
// Check if the path already has a version prefix (/v1/ or /v2/)
14-
const hasVersionPrefix = /^\/v[12]\//.test(normalizedPath);
13+
// Check if the path already has a version prefix (/v1 or /v2)
14+
const hasVersionPrefix = /^\/v[12](\/|$)/.test(normalizedPath);
1515

1616
// Case 1: Root path → redirect to /v2
1717
if (normalizedPath === "/" || normalizedPath === "") {

0 commit comments

Comments
 (0)