forked from svrjs/svrjs
Improve web root error handling
This commit is contained in:
parent
15ca36cf16
commit
2ec6b564f5
2 changed files with 9 additions and 7 deletions
|
@ -3,7 +3,7 @@
|
||||||
"port": 80,
|
"port": 80,
|
||||||
"pubport": 80,
|
"pubport": 80,
|
||||||
"page404": "404.html",
|
"page404": "404.html",
|
||||||
"timestamp": 1694334249412,
|
"timestamp": 1694363783457,
|
||||||
"blacklist": [],
|
"blacklist": [],
|
||||||
"nonStandardCodes": [],
|
"nonStandardCodes": [],
|
||||||
"enableCompression": true,
|
"enableCompression": true,
|
||||||
|
|
12
svr.js
12
svr.js
|
@ -1151,11 +1151,12 @@ if (configJSON.rewriteDirtyURLs != undefined) rewriteDirtyURLs = configJSON.rewr
|
||||||
if (configJSON.errorPages != undefined) errorPages = configJSON.errorPages;
|
if (configJSON.errorPages != undefined) errorPages = configJSON.errorPages;
|
||||||
if (configJSON.useWebRootServerSideScript != undefined) useWebRootServerSideScript = configJSON.useWebRootServerSideScript;
|
if (configJSON.useWebRootServerSideScript != undefined) useWebRootServerSideScript = configJSON.useWebRootServerSideScript;
|
||||||
if (configJSON.exposeModsInErrorPages != undefined) exposeModsInErrorPages = configJSON.exposeModsInErrorPages;
|
if (configJSON.exposeModsInErrorPages != undefined) exposeModsInErrorPages = configJSON.exposeModsInErrorPages;
|
||||||
if (configJSON.wwwroot != undefined) {
|
|
||||||
var wwwroot = configJSON.wwwroot;
|
var wwwrootError = null;
|
||||||
if (cluster.isPrimary || cluster.isPrimary === undefined) process.chdir(wwwroot);
|
try {
|
||||||
} else {
|
if (cluster.isPrimary || cluster.isPrimary === undefined) process.chdir(configJSON.wwwroot != undefined ? configJSON.wwwroot : __dirname);
|
||||||
if (cluster.isPrimary || cluster.isPrimary === undefined) process.chdir(__dirname);
|
} catch(err) {
|
||||||
|
wwwrootError = err;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Compability for older mods
|
// Compability for older mods
|
||||||
|
@ -4871,6 +4872,7 @@ function start(init) {
|
||||||
if (netIPs.indexOf(listenAddress) > -1) throw new Error("SVR.JS can't listen on subnet address.");
|
if (netIPs.indexOf(listenAddress) > -1) throw new Error("SVR.JS can't listen on subnet address.");
|
||||||
}
|
}
|
||||||
if(certificateError) throw new Error("There was a problem with SSL certificate/private key: " + certificateError.message);
|
if(certificateError) throw new Error("There was a problem with SSL certificate/private key: " + certificateError.message);
|
||||||
|
if(wwwrootError) throw new Error("There was a problem with your web root: " + wwwrootError.message);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Information about starting the server
|
// Information about starting the server
|
||||||
|
|
Reference in a new issue