paritybit.ca

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit f1913aba905fba7c27d0370a215794a4bc0eb995
parent ff17afbb50266ce12f62c6b8e86c6b099e37a73a
Author: Jake Bauer <jbauer@paritybit.ca>
Date:   Sun, 14 Apr 2019 17:31:30 -0400

Remove HSTS headers because nginx handles them

Diffstat:
Mserver/app.js | 22++++++----------------
1 file changed, 6 insertions(+), 16 deletions(-)

diff --git a/server/app.js b/server/app.js @@ -52,15 +52,13 @@ function handle_error(err, res) { // If the file cannot be found on the server if (err.code === "ENOENT") { fs.readFile("./public/html/404.html", (err, content) => { - res.writeHead(404, {"Content-Type": "text/html", - "Strict-Transport-Security": "max-age=604800; includeSubDomains"}); + res.writeHead(404, {"Content-Type": "text/html"}); res.end(content, "utf-8"); }); } else { // If there is any other error, report error 500 - res.writeHead(500, {"Content-Type": "text/plain", - "Strict-Transport-Security": "max-age=604800; includeSubDomains"}); + res.writeHead(500, {"Content-Type": "text/plain"}); res.end("HTTP Server Error: " + err.code + "\n"); } } @@ -83,17 +81,13 @@ function serve_regular_file(filePath, contentType, req, res) { // If the resource is cached, send code 304 and don't send resource if (etag === req.headers["if-none-match"]) { res.writeHead(304, {"Content-Type": contentType, - "Strict-Transport-Security": "max-age=604800;" - + " includeSubDomains", "Cache-Control": "max-age=120", - "ETag": etag }); + "Cache-Control": "max-age=120", "ETag": etag }); res.end(); } else { // Otherwise, send the file res.writeHead(200, {"Content-Type": contentType, - "Strict-Transport-Security": "max-age=604800;" - +" includeSubDomains", "Cache-Control": "max-age=120", - "ETag": etag}); + "Cache-Control": "max-age=120", "ETag": etag}); res.end(content, "utf-8"); } } @@ -106,18 +100,14 @@ function serve_large_file(filePath, fileSize, contentType, req, res) { let etag = fileSize; if (etag === req.headers["if-none-match"]) { res.writeHead(304, {"Content-Type": contentType, - "Content-Length": fileSize, - "Strict-Transport-Security": "max-age=604800; includeSubDomains", - "ETag": etag, + "Content-Length": fileSize, "ETag": etag, "Cache-Control": "max-age=120"}); res.end(); } else { // Otherwise, send the file res.writeHead(200, {"Content-Type": contentType, - "Content-Length": fileSize, - "Strict-Transport-Security": "max-age=604800; includeSubDomains", - "ETag": etag, + "Content-Length": fileSize, "ETag": etag, "Cache-Control": "max-age=120"}); let readStream = fs.createReadStream(filePath); readStream.on("open", () => {