Closed lukeed closed 4 years ago
Should be as simple as modifying the context within a preload function:
context
preload
export function preload(req, context) { context.redirect = 'https://new.location'; context.status = 301; // 302 default }
The trigger is the redirect key, not the status code value! Relative paths will be resolved from the current req.url.
redirect
req.url
Can be fulfilled on client-side too, except status change. This would use a history.replaceState when context.redirect exists.
history.replaceState
context.redirect
Should be as simple as modifying the
context
within apreload
function:The trigger is the
redirect
key, not the status code value! Relative paths will be resolved from the currentreq.url
.Can be fulfilled on client-side too, except status change. This would use a
history.replaceState
whencontext.redirect
exists.