aboutsummaryrefslogtreecommitdiff
path: root/src/server/server_Initialization.ts
diff options
context:
space:
mode:
authorsrichman333 <sarah_n_richman@brown.edu>2023-08-14 23:01:18 -0400
committersrichman333 <sarah_n_richman@brown.edu>2023-08-14 23:01:18 -0400
commit48ca2299b805db282b2b5d559cf27291fdc119ac (patch)
treeb5a8baccf36dc7e7980c0b34415c602921d3ec8a /src/server/server_Initialization.ts
parent9dbd9efeb0080418fcb44c5c78511fffa09ad229 (diff)
parent3b45f1d30a947dc1702ec347b83e98374c5b603c (diff)
Merge branch 'master' into data-visualization-sarah
Diffstat (limited to 'src/server/server_Initialization.ts')
-rw-r--r--src/server/server_Initialization.ts4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/server/server_Initialization.ts b/src/server/server_Initialization.ts
index c1934451c..354f809e0 100644
--- a/src/server/server_Initialization.ts
+++ b/src/server/server_Initialization.ts
@@ -100,7 +100,7 @@ function buildWithMiddleware(server: express.Express) {
passport.session(),
(req: express.Request, res: express.Response, next: express.NextFunction) => {
res.locals.user = req.user;
- if (req.originalUrl.endsWith('.png') /*|| req.originalUrl.endsWith(".js")*/ && req.method === 'GET' && (res as any)._contentLength) {
+ if ((req.originalUrl.endsWith('.png') || req.originalUrl.endsWith('.jpg') || (process.env.RELEASE === 'true' && req.originalUrl.endsWith('.js'))) && req.method === 'GET') {
const period = 30000;
res.set('Cache-control', `public, max-age=${period}`);
} else {
@@ -176,6 +176,8 @@ function proxyServe(req: any, requrl: string, response: any) {
const htmlText = htmlInputText
.toString('utf8')
.replace('<head>', '<head> <style>[id ^= "google"] { display: none; } </style>')
+ .replace('<script', '<noscript')
+ .replace('</script', '</noscript')
// .replace(/href="https?([^"]*)"/g, httpsToCors)
.replace(/data-srcset="[^"]*"/g, '')
.replace(/srcset="[^"]*"/g, '')