Skip to content
This repository was archived by the owner on Aug 6, 2025. It is now read-only.

Commit 9d07f16

Browse files
committed
vcl for redirects
1 parent ed4b2e1 commit 9d07f16

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

scripts/vcl/catch.vcl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
declare local var.mapUrl STRING;
2+
set var.mapUrl = regsuball(req.url.path, "/core/", "");
3+
4+
if (table.lookup(redirect_map, var.mapUrl)) {
5+
error 718 "redirect";
6+
}

scripts/vcl/catcherror.vcl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
if (obj.status == 718 && obj.response == "redirect") {
2+
set obj.status = 308;
3+
declare local var.mapUrl STRING;
4+
set var.mapUrl = regsuball(req.url.path, "/core/", "");
5+
set obj.http.Location = table.lookup(redirect_map, var.mapUrl);
6+
return (deliver);
7+
}

0 commit comments

Comments
 (0)