Mecanik / cloudflare-image-resizing-worker

Cloudflare Image Resizing worker for WordPress
Apache License 2.0
41 stars 9 forks source link

Images not loading when a wildcard is used in Route #2

Closed danmaby closed 1 year ago

danmaby commented 1 year ago

Hey, firstly - thank you for taking the time to write this and share!

I'm having an issue formatting the URL in the Trigger for the Worker. I'm trying to set this up on the site https://blog.bigorangeheart.org/. In the Route for the Worker, I initially set the URL to blog.bigorangeheart.org/*, but this returned no images on the site.

Having tried several variations of the URLs in the Route, I found that if I set the Route to a specific URL, such as blog.bigorangeheart.org/2020/04/mental-illness with no wildcard, and no trailing /, then the images are resized and delivered as expected on that specific page. As can be seen here https://blog.bigorangeheart.org/2020/04/mental-illness/. Are you able to advise on how I can set this on the subdomain using a wildcard?

Variations I've tried:

Edit:

I can see a known issue in relation to route specificity, but in my case, I'm only running one worker. So this may not be an issue.

Mecanik commented 1 year ago

Hello, thanks. I have checked your website and I cannot see a problem with it. Since the page https://blog.bigorangeheart.org/2020/04/mental-illness/ executes fine, it makes me believe the issue is somewhere else.

When you deployed normally to blog.bigorangeheart.org/*, and the images were not showing, did you check your browser developer console to see any errors? It's very curious.

On another note, I can help you check this in private if you email me. You can use the contact form on my site if you wish.

Thanks

danmaby commented 1 year ago

Hey @Mecanik, thanks for the quick response and offer to support privately.

Currently, I have the Route set with the specific URL to blog.bigorangeheart.org/2020/04/mental-illness, so only that page is served as expected with resized WebP images. Changing the URL in the Route to blog.bigorangeheart.org/* results in all images returning 404s. When the Workers Route is set to this, the URLs are rewritten like so:

https://blog.bigorangeheart.org/cdn-cgi/image/width=1024,quality=90,format=auto,onerror=redirect,metadata=none/wp-content/uploads/2022/11/WFL-Blog-Hero-1024x538.png
Mecanik commented 1 year ago

This is extremely weird. Are you sure Image Resizing is enabled right now on your Cloudflare dashboard? The URL is perfectly fine, however it says 404.

danmaby commented 1 year ago

Yes, very strange. Image Resizing is active on the account. I thought I'd try it on another subdoamin and I'm seeing the same issue - https://events.bigorangeheart.org/ - is current setup with events.bigorangeheart.org/* for the Route. You'll see all images on the site return a 404.

Mecanik commented 1 year ago

This makes no sense and requires a more direct investigation. Please check your email.

Mecanik commented 1 year ago

Still waiting on your reply, thanks.

Mecanik commented 1 year ago

Since we resolved the issue privately, I will close this issue. Nice working with you :)