openvibers/openvibe.community Commits

/auth/me is not counted by the sign-in limiter: 60 page views in 15 minutes made a signed-in visitor look signed out (#142)

OP OpenVibers committed 17 days ago · 23242b59aa · 1 file, +2 −1

Changes

ddiff --git a/server/app.js b/server/app.js
iindex fdc7db7..7291a11 100644
---- a/server/app.js
++++ b/server/app.js
@@@ -119,7 +119,8 @@ async function createApp(opts = {}) {
const auth = opts.auth || createAuthClient(config);
app.locals.auth = auth;
app.locals.config = config;
-- app.use('/auth/', rateLimit({ windowMs: 15 * 60_000, max: 60, standardHeaders: true, legacyHeaders: false }));
++ // /auth/me is the navbar's who-is-signed-in read on every page, so it is not counted with sign-ins: 60 page views in 15 minutes made a signed-in visitor look signed out.
++ app.use('/auth/', rateLimit({ windowMs: 15 * 60_000, max: 60, skip: (req) => req.path === '/me', standardHeaders: true, legacyHeaders: false }));
app.use('/auth', createAuthRoutes(config, auth));
{ const legal = require('openvibe-shared/legal'); app.get(legal.PATHS, legal.handler({ id: 'community', service: 'community', host: 'openvibe.community', name: 'OpenVibe.Community', profile: 'ugc' })); app.get('/tos', (_req, res) => res.redirect(301, '/terms')); }