config response header

This commit is contained in:
Louis Lam 2021-10-19 14:26:10 +08:00
parent c6fc385289
commit 62f168a2a5

View File

@ -119,6 +119,13 @@ const { statusPageSocketHandler } = require("./socket-handlers/status-page-socke
app.use(express.json()); app.use(express.json());
// Global Middleware
app.use(function (req, res, next) {
res.setHeader("X-Frame-Options", "SAMEORIGIN");
res.removeHeader("X-Powered-By");
next();
});
/** /**
* Total WebSocket client connected to server currently, no actual use * Total WebSocket client connected to server currently, no actual use
* @type {number} * @type {number}
@ -192,7 +199,7 @@ exports.entryPage = "dashboard";
const apiRouter = require("./routers/api-router"); const apiRouter = require("./routers/api-router");
app.use(apiRouter); app.use(apiRouter);
// Universal Route Handler, must be at the end of all express route. // Universal Route Handler, must be at the end of all express routes.
app.get("*", async (_request, response) => { app.get("*", async (_request, response) => {
if (_request.originalUrl.startsWith("/upload/")) { if (_request.originalUrl.startsWith("/upload/")) {
response.status(404).send("File not found."); response.status(404).send("File not found.");