mirror of
https://github.com/edumeet/edumeet.git
synced 2026-08-04 08:42:49 +00:00
Merge branch 'feat-server-http-cache-header' into feat-local-develop-and-monitoring
This commit is contained in:
commit
cda5be098e
2 changed files with 19 additions and 1 deletions
|
|
@ -364,6 +364,9 @@ module.exports =
|
|||
requestTimeout : 20000,
|
||||
// Socket retries when timeout
|
||||
requestRetries : 3,
|
||||
// If > 0, sets a cache-control max-age (in seconds) to the GET response
|
||||
// headers.
|
||||
getRequestsCachePeriod : 0,
|
||||
// Mediasoup settings
|
||||
mediasoup :
|
||||
{
|
||||
|
|
|
|||
|
|
@ -87,12 +87,27 @@ const tls =
|
|||
const app = express();
|
||||
|
||||
app.use(helmet.hsts());
|
||||
const sharedCookieParser=cookieParser();
|
||||
const sharedCookieParser = cookieParser();
|
||||
|
||||
app.use(sharedCookieParser);
|
||||
app.use(bodyParser.json({ limit: '5mb' }));
|
||||
app.use(bodyParser.urlencoded({ limit: '5mb', extended: true }));
|
||||
|
||||
if (config.getRequestsCachePeriod > 0)
|
||||
{
|
||||
app.use((req, res, next) => {
|
||||
if (req.method === 'GET')
|
||||
{
|
||||
res.set('Cache-control', `public, max-age=${config.getRequestsCachePeriod}`)
|
||||
}
|
||||
else
|
||||
{
|
||||
res.set('Cache-control', 'no-store');
|
||||
}
|
||||
next();
|
||||
});
|
||||
}
|
||||
|
||||
const session = expressSession({
|
||||
secret : config.cookieSecret,
|
||||
name : config.cookieName,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue