diff --git a/core/server/web/parent/app.js b/core/server/web/parent/app.js index a9a1b71f40..1ec4d68487 100644 --- a/core/server/web/parent/app.js +++ b/core/server/web/parent/app.js @@ -5,6 +5,7 @@ const config = require('../../config'); const compress = require('compression'); const netjet = require('netjet'); const shared = require('../shared'); +const mw = require('./middleware'); const escapeRegExp = require('lodash.escaperegexp'); const {URL} = require('url'); const sentry = require('../../sentry'); @@ -20,7 +21,7 @@ module.exports = function setupParentApp(options = {}) { // (X-Forwarded-Proto header will be checked, if present) parentApp.enable('trust proxy'); - parentApp.use(shared.middlewares.requestId); + parentApp.use(mw.requestId); parentApp.use(shared.middlewares.logRequest); // Register event emmiter on req/res to trigger cache invalidation webhook event diff --git a/core/server/web/parent/middleware/index.js b/core/server/web/parent/middleware/index.js new file mode 100644 index 0000000000..31975fcda5 --- /dev/null +++ b/core/server/web/parent/middleware/index.js @@ -0,0 +1,3 @@ +module.exports = { + requestId: require('./request-id') +}; diff --git a/core/server/web/shared/middlewares/request-id.js b/core/server/web/parent/middleware/request-id.js similarity index 100% rename from core/server/web/shared/middlewares/request-id.js rename to core/server/web/parent/middleware/request-id.js diff --git a/core/server/web/shared/middlewares/index.js b/core/server/web/shared/middlewares/index.js index fd958e47b7..db84727f7e 100644 --- a/core/server/web/shared/middlewares/index.js +++ b/core/server/web/shared/middlewares/index.js @@ -51,10 +51,6 @@ module.exports = { return require('./pretty-urls'); }, - get requestId() { - return require('./request-id'); - }, - get uncapitalise() { return require('./uncapitalise'); }, diff --git a/test/unit/web/middleware/request-id_spec.js b/test/unit/web/parent/middleware/request-id_spec.js similarity index 92% rename from test/unit/web/middleware/request-id_spec.js rename to test/unit/web/parent/middleware/request-id_spec.js index 878d966e5f..6b49efd393 100644 --- a/test/unit/web/middleware/request-id_spec.js +++ b/test/unit/web/parent/middleware/request-id_spec.js @@ -2,7 +2,7 @@ const should = require('should'); const sinon = require('sinon'); const validator = require('validator'); -const requestId = require('../../../../core/server/web/shared/middlewares/request-id'); +const requestId = require('../../../../../core/server/web/parent/middleware/request-id'); describe('Request ID middleware', function () { var res, req, next;