diff --git a/src/steps/utils.js b/src/steps/utils.js index f89f105c..dafdd3a8 100644 --- a/src/steps/utils.js +++ b/src/steps/utils.js @@ -14,7 +14,7 @@ const AZURE_BLOB_REGEXP = /^https:\/\/hlx\.blob\.core\.windows\.net\/external\// const MEDIA_BLOB_REGEXP = /^https:\/\/.*\.(aem|hlx3?)\.(live|page)\/media_.*/; -const HELIX_URL_REGEXP = /^https:\/\/(?!admin\.|www\.)[^.]+\.(aem|hlx3?)\.(live|page)\/?.*/; +const HELIX_URL_REGEXP = /^https:\/\/.*\.(aem|hlx3?)\.(live|page)\/?.*/; /** * Returns the original host name from the request to the outer CDN. @@ -208,7 +208,7 @@ export function rewriteUrl(state, url) { return `.${pathname}${hash}`; } - if (HELIX_URL_REGEXP.test(url) + if ((host.includes('--') && HELIX_URL_REGEXP.test(url)) || host === state.previewHost || host === state.liveHost) { if (hash && pathname === state.info?.path) { diff --git a/test/steps/utils.test.js b/test/steps/utils.test.js index 2fe6f959..97d255d7 100644 --- a/test/steps/utils.test.js +++ b/test/steps/utils.test.js @@ -163,6 +163,7 @@ describe('Rewrite URLs test', () => { it('keeps helix urls for www and admin in place', () => { assert.strictEqual(rewriteUrl({}, 'https://www.hlx.page/docs'), 'https://www.hlx.page/docs'); assert.strictEqual(rewriteUrl({}, 'https://www.aem.live/docs'), 'https://www.aem.live/docs'); + assert.strictEqual(rewriteUrl({}, 'https://tools.aem.live/docs'), 'https://tools.aem.live/docs'); assert.strictEqual(rewriteUrl({}, 'https://admin.hlx.live/api'), 'https://admin.hlx.live/api'); });