diff --git a/.changeset/orange-countries-scream.md b/.changeset/orange-countries-scream.md new file mode 100644 index 000000000..f81c4506c --- /dev/null +++ b/.changeset/orange-countries-scream.md @@ -0,0 +1,5 @@ +--- +'@astrojs/netlify': patch +--- + +Allows `-` in hostnames for Netlify Image CDN RegEx diff --git a/packages/netlify/src/index.ts b/packages/netlify/src/index.ts index 92f4b8a4d..07d5bf01d 100644 --- a/packages/netlify/src/index.ts +++ b/packages/netlify/src/index.ts @@ -46,11 +46,11 @@ export function remotePatternToRegex( if (hostname) { if (hostname.startsWith('**.')) { // match any number of subdomains - regexStr += '([a-z0-9]+\\.)*'; + regexStr += '([a-z0-9-]+\\.)*'; hostname = hostname.substring(3); } else if (hostname.startsWith('*.')) { // match one subdomain - regexStr += '([a-z0-9]+\\.)?'; + regexStr += '([a-z0-9-]+\\.)?'; hostname = hostname.substring(2); // Remove '*.' from the beginning } // Escape dots in the hostname