Added http to https redirection

main
John Hays 7 months ago
parent dc9a97383a
commit 511ce019cd

@ -52,6 +52,8 @@ It should also run under the newer/faster [Bun Runtime](https://bun.sh/)
If it comes up successfully, go to a browser and put in a HTTPS request to your domain name. If you get a dashboard, you have done everything correctly.
The install will redirect http to https, if you don't want the redirect, see the end of [index.js](index.js)
I have included a systemd service file in the util subdirectory which can be copied to /lib/systemd/system
```
sudo cp util/dsgwdashboard.service /lib/systemd/system

@ -135,3 +135,12 @@ const tailheaders = new Tail(headers, {startPos : 'end'}, line => {
});
tailheaders.start();
// Comment out the following lines if you don't want to redirect http to https
var http = require("http");
http
.createServer(function (req, res) {
res.writeHead(301, { Location: "https:"+host });
res.end();
})
.listen(80);

6
package-lock.json generated

@ -13,6 +13,7 @@
"configparser": "^0.3.10",
"express": "^4.18.2",
"express-ws": "^5.0.2",
"http": "^0.0.1-security",
"ini": "^4.1.1",
"jquery": "^3.7.1",
"line-reader": "^0.4.0",
@ -479,6 +480,11 @@
"node": ">= 0.4"
}
},
"node_modules/http": {
"version": "0.0.1-security",
"resolved": "https://registry.npmjs.org/http/-/http-0.0.1-security.tgz",
"integrity": "sha512-RnDvP10Ty9FxqOtPZuxtebw1j4L/WiqNMDtuc1YMH1XQm5TgDRaR1G9u8upL6KD1bXHSp9eSXo/ED+8Q7FAr+g=="
},
"node_modules/http-errors": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz",

@ -4,6 +4,7 @@
"configparser": "^0.3.10",
"express": "^4.18.2",
"express-ws": "^5.0.2",
"http": "^0.0.1-security",
"ini": "^4.1.1",
"jquery": "^3.7.1",
"line-reader": "^0.4.0",

Loading…
Cancel
Save