diff --git a/server/plugins/router/router.module.js b/server/plugins/router/router.module.js index ecbed056..2d854ef5 100644 --- a/server/plugins/router/router.module.js +++ b/server/plugins/router/router.module.js @@ -11,6 +11,7 @@ const internals = { renderer: '/{url*}', staticAssets: '/assets/{path*}', internalApi: '/internalapi/{path*}', + storefrontAPI: '/api/storefront/{path*}', cdnAssets: '/stencil/{versionId}/{fileName*}', cssFiles: '/stencil/{versionId}/css/{fileName}.css', favicon: '/favicon.ico', @@ -109,6 +110,25 @@ internals.registerRoutes = function(server, next) { }, }, }, + { + method: ['GET', 'POST', 'PUT', 'PATCH', 'DELETE', 'OPTIONS'], + path: internals.paths.storefrontAPI, + handler: { + proxy: { + host: internals.options.storeUrl.replace(/http[s]?:\/\//, ''), + rejectUnauthorized: false, + protocol: 'https', + port: 443, + passThrough: true, + xforward: true, + }, + }, + config: { + state: { + failAction: 'log', + }, + }, + }, { method: 'GET', path: internals.paths.favicon,