elabx Posted September 18, 2019 Share Posted September 18, 2019 Ok so just stumbled into a website using Clouflare and the plain htaccess method doesn't seem to kick in, tried altering the url() method with a hook but stumbled back into the problem problem where it doesn't seem to work after applying size(). Anybody has some info on this? if($page->template != 'admin') { $wire->addHookAfter('Pageimage::url', function($event) { static $n = 0; $n = ++$n; if($n === 1){ $event->return = $event->object->webp()->url(); } $n--; }); } Link to comment Share on other sites More sharing options...
wbmnfktr Posted September 18, 2019 Share Posted September 18, 2019 Does it work when you enable developer mode in Cloudflare? Just to check if it's really a Cloudflare issue. Link to comment Share on other sites More sharing options...
elabx Posted September 18, 2019 Author Share Posted September 18, 2019 6 minutes ago, wbmnfktr said: Does it work when you enable developer mode in Cloudflare? Just to check if it's really a Cloudflare issue. Unfortunately I don't have access to the cloudflare account :/ Link to comment Share on other sites More sharing options...
wbmnfktr Posted September 18, 2019 Share Posted September 18, 2019 Ok... that's tough than. I changed one of my sites (behind Cloudflares Free Plan) to strategy 1 as described here: https://processwire.com/blog/posts/webp-images-and-more/#strategy-1-automatically-delivering-webp-for-jpg-png-images It works, even in image URLs generated with size(). Ryan says this in the article: Quote These rewrite rules will need adjustment if you are using $config->pagefileExtendedPaths (though I don’t think many are using that option). Maybe that's the reason. Link to comment Share on other sites More sharing options...
elabx Posted September 18, 2019 Author Share Posted September 18, 2019 58 minutes ago, wbmnfktr said: I changed one of my sites (behind Cloudflares Free Plan) to strategy 1 as described here: https://processwire.com/blog/posts/webp-images-and-more/#strategy-1-automatically-delivering-webp-for-jpg-png-images This is my "go to" approach but susprisingly it didn't work out as expected. It just delivers the normal jpg image it's as if it's not redirecting the webp header or something, that's why I decided to switch to the extension hook but then I stumbled into this. Maybe I should open a github issue? Link to comment Share on other sites More sharing options...
wbmnfktr Posted September 18, 2019 Share Posted September 18, 2019 I guess it's still too early for an issue response on Github. Let's compare the things we can compare: ProcessWire 3.0.132 PHP 7.2 Cloudflare Free Plan (default settings) webP Strategy 1 htaccess: non-www Redirect htaccess: https Redirect pagefileExtendedPaths NOT set As you don't have access to the Cloudflare settings... is there someone who can look into it? Maybe they use a load balancer, built in whatever. Maybe the site is still cached. Cloudflare CDN is sometimes bit of a PITA. Dev-Mode or DNS-by-pass would be nice to test out. Maybe there are even custom page rules that are image related. There is a lot of stuff someone can do there. Link to comment Share on other sites More sharing options...
elabx Posted September 26, 2019 Author Share Posted September 26, 2019 Hu @wbmnfktr!! Your post just made me realize, I'm using Runcloud so I have nginx in front of Apache, and just tested another site that is not using cloudflare and same issue, webp is not being delivered. So maybe that could be it? Cause i remember the http-to-https redirect had an issue, so i had to use a special one. Link to comment Share on other sites More sharing options...
wbmnfktr Posted September 27, 2019 Share Posted September 27, 2019 I don't know if this could be the reason. I know that there is one project - I maintain - with a Cloudflare -> Nginx -> Apache setup. Maybe I'll find the time to play around with it on the weekend. For the moment... ¯\_(ツ)_/¯ Link to comment Share on other sites More sharing options...
elabx Posted September 27, 2019 Author Share Posted September 27, 2019 3 hours ago, wbmnfktr said: For the moment... ¯\_(ツ)_/¯ hahaha thanks a lot for you help and patience! I just pinged on an nginx thread to check if anyone's got some more info. 2 Link to comment Share on other sites More sharing options...
wbmnfktr Posted September 27, 2019 Share Posted September 27, 2019 You're welcome! I wish I could help more. 2 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now