avoid redirect when served directly from versioned url
This commit is contained in:
parent
a4e687f709
commit
e12f498afa
1 changed files with 3 additions and 4 deletions
7
app.js
7
app.js
|
|
@ -341,12 +341,11 @@ const redirList = [
|
|||
|
||||
function handleVersion(req, res, next) {
|
||||
let vstr = oversion || dversion || version;
|
||||
if (!redirList.indexOf(req.app.path) >= 0 && req.url.indexOf(vstr) < 0) {
|
||||
let pp = req.app.ispre ? pre : undefined;
|
||||
if (!req.app.ispre && !redirList.indexOf(req.app.path) >= 0 && req.url.indexOf(vstr) < 0) {
|
||||
if (req.url.indexOf("?") > 0) {
|
||||
return http.redirect(res, `${pp??''}${req.url},ver:${vstr}`);
|
||||
return http.redirect(res, `${req.url},ver:${vstr}`);
|
||||
} else {
|
||||
return http.redirect(res, `${pp??''}${req.url}?ver:${vstr}`);
|
||||
return http.redirect(res, `${req.url}?ver:${vstr}`);
|
||||
}
|
||||
} else if (!debug) {
|
||||
// in production serve packed bundles
|
||||
|
|
|
|||
Loading…
Reference in a new issue