add more servce worker boot controls
disable scarf by default handle redirect with query
This commit is contained in:
parent
38a6ef8f03
commit
3bc0f0cfc2
4 changed files with 62 additions and 37 deletions
8
app.js
8
app.js
|
|
@ -526,7 +526,13 @@ function fixedmap(prefix, map) {
|
|||
// HTTP 307 redirect
|
||||
function redir(path, type) {
|
||||
return (req, res, next) => {
|
||||
http.redirect(res, path, type);
|
||||
let query = req.url.split('?')[1];
|
||||
let rpath = path;
|
||||
if (query && path.indexOf('?') < 0) {
|
||||
rpath += `?${query}`;
|
||||
}
|
||||
// console.log({ redir: req.url, to: path, query, new_path: rpath });
|
||||
http.redirect(res, rpath, type);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue