diff --git a/services/web/app/src/infrastructure/ExpressLocals.js b/services/web/app/src/infrastructure/ExpressLocals.js index 167e99a559..1c4588d1e7 100644 --- a/services/web/app/src/infrastructure/ExpressLocals.js +++ b/services/web/app/src/infrastructure/ExpressLocals.js @@ -9,6 +9,7 @@ const moment = require('moment') const request = require('request') const Features = require('./Features') const SessionManager = require('../Features/Authentication/SessionManager') +const SplitTestMiddleware = require('../Features/SplitTests/SplitTestMiddleware') const PackageVersions = require('./PackageVersions') const Modules = require('./Modules') const { @@ -18,6 +19,7 @@ const { const { addOptionalCleanupHandlerAfterDrainingConnections, } = require('./GracefulShutdown') +const { expressify } = require('../util/promises') const IEEE_BRAND_ID = Settings.ieeeBrandId @@ -76,6 +78,15 @@ function getWebpackAssets(entrypoint, section) { } module.exports = function (webRouter, privateApiRouter, publicApiRouter) { + webRouter.use( + expressify( + SplitTestMiddleware.loadAssignmentsInLocals([ + 'design-system-updates', + 'features-page', + ]) + ) + ) + if (process.env.NODE_ENV === 'development') { // In the dev-env, delay requests until we fetched the manifest once. webRouter.use(function (req, res, next) { diff --git a/services/web/app/src/router.js b/services/web/app/src/router.js index 2699ddbf9a..a4075022f8 100644 --- a/services/web/app/src/router.js +++ b/services/web/app/src/router.js @@ -56,7 +56,6 @@ const UserMembershipRouter = require('./Features/UserMembership/UserMembershipRo const SystemMessageController = require('./Features/SystemMessages/SystemMessageController') const AnalyticsRegistrationSourceMiddleware = require('./Features/Analytics/AnalyticsRegistrationSourceMiddleware') const AnalyticsUTMTrackingMiddleware = require('./Features/Analytics/AnalyticsUTMTrackingMiddleware') -const SplitTestMiddleware = require('./Features/SplitTests/SplitTestMiddleware') const CaptchaMiddleware = require('./Features/Captcha/CaptchaMiddleware') const { Joi, validate } = require('./infrastructure/Validation') const { @@ -66,7 +65,6 @@ const { const logger = require('@overleaf/logger') const _ = require('underscore') -const { expressify } = require('./util/promises') const { plainTextResponse } = require('./infrastructure/Response') const PublicAccessLevels = require('./Features/Authorization/PublicAccessLevels') const UserContentDomainController = require('./Features/UserContentDomainCheck/UserContentDomainController') @@ -229,15 +227,6 @@ function initialize(webRouter, privateApiRouter, publicApiRouter) { webRouter.get('*', AnalyticsRegistrationSourceMiddleware.setInbound()) webRouter.get('*', AnalyticsUTMTrackingMiddleware.recordUTMTags()) - webRouter.get( - '*', - expressify( - SplitTestMiddleware.loadAssignmentsInLocals([ - 'design-system-updates', - 'features-page', - ]) - ) - ) // Mount onto /login in order to get the deviceHistory cookie. webRouter.post(