mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-10-29 22:21:50 -05:00
26 lines
1.3 KiB
Diff
26 lines
1.3 KiB
Diff
diff --git a/dist/cli.js b/dist/cli.js
|
|
index 7871cebe46f6df886b76364db5346adfa1838622..3189db69a236f65f99338c672b0b8c766a31e523 100644
|
|
--- a/dist/cli.js
|
|
+++ b/dist/cli.js
|
|
@@ -110,15 +110,16 @@ async function run() {
|
|
};
|
|
let app = express();
|
|
app.disable("x-powered-by");
|
|
- if (!isRSCBuild) app.use(compression());
|
|
+ app.set("trust proxy", true);
|
|
let expressPublicPath = getExpressPath(build.publicPath);
|
|
app.use(path.posix.join(expressPublicPath, "assets"), express.static(path.join(build.assetsBuildDirectory, "assets"), {
|
|
immutable: true,
|
|
maxAge: "1y"
|
|
}));
|
|
- app.use(expressPublicPath, express.static(build.assetsBuildDirectory));
|
|
- app.use(express.static("public", { maxAge: "1h" }));
|
|
- app.use(morgan("tiny"));
|
|
+ // patched: page and .data requests skip the static file lookups, two fs.stat calls each
|
|
+ let onlyForFiles = (middleware) => (req, res, next) => /\.[^/.]+$/.test(req.path) && !req.path.endsWith(".data") ? middleware(req, res, next) : next();
|
|
+ app.use(expressPublicPath, onlyForFiles(express.static(build.assetsBuildDirectory)));
|
|
+ app.use(onlyForFiles(express.static("public", { maxAge: "1h" })));
|
|
if (build.fetch) app.all("/{*splat}", createRequestListener(build.fetch));
|
|
else app.all("/{*splat}", createRequestHandler({
|
|
build: buildModule,
|