Page loading extremely slow, or generating a 500 error

There is a “where to buy” section of this site which loads extremely slow or generates 500 errors when proxied through Cloudflare. Changing my hosts file to point directly to the webserver IP gives very fast page loads for the same URL.

Note that if the page load succeeds and is cached, subsequent loads will be quick. So you may need to change the zipcode in this URL to get an uncached page:

https://www.senco.com/dealer-locator/?userAddress=45218&maxRadius=50&search=1

Any idea why these page requests load so slowly?

I could see that. I did not get any 500s, but page took over 40s to load!

You seem to be using APO. APO will not cache a page when there’s a query string, returning a cf-cache-status: DYNAMIC. I also noticed that origin cache was also a MISS. That forces your server to redraw the page every time there’s a request, which is of course not the desired behavior.

Why is your server taking so long to prepare that page is beyond the escope of this community. And perhaps when you are not using Cloudflare the local cache responds with a HIT and therefore the time to prepare the page is much smaller? (I’m just speculating here, as I have no way to know what settings your local cache plugin or server config are.)

In any case, there are two possible solutions to make sure that similar pages, with a query string but not containing personal information, are returned faster.

The first would be to use a plugin (or ask a developer) to change these URLs to eliminate the query string. This way APO will cache these pages, and the result will be the best:

from:

https://www.example.com/my-page/?query_param_A=1&query_param_B=2

to

https://www.example.com/my-page/query_param_A/1/query_param_B/2/

If that’s not feasible for some reason, you can create a Cache Rule (beta) to cache such pages. In combination with Tiered Cache set to ON, this will result in the second best speed:

When incoming requests match:
Query String contains "query_param_A"
OR
Query String contains "query_param_B"

Before you test and implement any Cache Rule, make sure you get familiar with how they work. You can set Edge Cache TTL and Browser Cache TTL to whatever amount of time you think reasonable, or even set it to respect existing origin. These cached pages may not be automatically purged by APO. In case you change their layout or content. So you need to make sure you purge the cache for these pages (sometimes the theme or your cache plugin may do this for you, if properly set with a Cloudflare API token.)

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.