Google Cloud CDN single file multiple filename/route with regex and htaccess

142 Views Asked by At

I search a solution for this: On Google Cloud Storage bucket stored a file: /2023-2.jpg

So if browser open

xyz.com/2023-2-abc.jpg xyz.com/2023-2-cba.jpg etc.

i want to the CDN load this (not redirect): xyz.com/2023-2.jpg file

I want to reach this file with these url address regex scheme: (\d+)-(\d+)-(.*).jpg /$1-$2.jpg

1

There are 1 best solutions below

0
Dave On

Neither Media CDN nor Cloud CDN support blob matching. Wildcard matching is possible based on a directory level, which would allow for URL rewriting; however this won't allow you to extract a portion of the path value and rewrite the go forward URL path. The wildcard and variable match is an all or nothing thing at the moment.

While the documentation shared is for Media CDN, Cloud CDN can support the same wildcard pattern matching via the new Application Load Balancer (NOT the Classic Application Load Balancer) via the Envoy YAML in the URL Map.