feat: add redirect
This commit is contained in:
parent
e38ffbedf4
commit
c923126eff
3 changed files with 53 additions and 2 deletions
|
|
@ -205,6 +205,25 @@ let
|
|||
proxyWebsockets = route.content.proxyWebsockets;
|
||||
};
|
||||
}
|
||||
else if route.type == "redirect" then
|
||||
let
|
||||
redirectTarget =
|
||||
if builtins.isString route.content then
|
||||
route.content
|
||||
else
|
||||
route.content.target;
|
||||
redirectStatus =
|
||||
if builtins.isAttrs route.content && route.content ? status then
|
||||
route.content.status
|
||||
else
|
||||
301;
|
||||
in
|
||||
{
|
||||
name = "= ${route.endpoint}";
|
||||
value = {
|
||||
return = "${toString redirectStatus} ${redirectTarget}";
|
||||
};
|
||||
}
|
||||
else if route.type == "inline" then
|
||||
let
|
||||
inlineBody =
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue