CF taking too much time to get HTTP data

According to my host, I already have a forced SSL, yet GTMetrix is telling me I have a 301 due to response headers (see screenshot).

Is this 100% something that I need to connect with my host about, or might this issue be resolved by tweaking some settings in CF?

Thanks,38%20PM

A 301 is normal because you didn’t type in HTTPS at GTMetrix. Typing in only your hostname will default to HTTP. Put an HTTPS:// in, and you won’t get that 301.

But I do see it took 4.5 seconds for the redirect. If you go to the SSL/TLS page in the Cloudflare Dashboard and choose the “Edge Certificates” section , scroll down and enable “Always use HTTPS” and that should speed up the redirect.

Thanks kindly for your reply,

I did plug-in the https version in GTMetrix and it looks like the 301 is still there (see screenshot).

Re: the edge certificates improvement – thank you, I’ll go ahead and instruct it to force HTTPS.

Your site strips off the www. Any time you don’t type in the correct URL (un-used www, or HTTP), you’re going to get a 301. There’s no way around that. Type in what your website really uses, and you won’t get a 301. Search engine crawlers figure this out and provide the correct link when your site comes up in a search.

2 Likes

Ah, yes, Re: GTMetrix, you are correct – thank you!

I did go ahead and turned on the “Always Use HTTPS” switch, cleared the cache, and so far, the speed is still about the same, but it makes perfect sense to have that filter on. Thanks again.

Hi @asmith,

As @sdayman has said, you should always do page speed tests with tools such as GTMetrix, webpagetest.org etc using the canonical URL, because that’s what most of your visitors will hopefully click on when they find your site in search engines or social networks.

However, doing a site:example.com search on Google I see that your site has pages indexed both with and without the www, which from a SEO standpoint is a no-no.

So you need to (1) decide whether you want your site to have naked domain or www version as canonical; and (2) implement a redirect to force all visitors (including Google crawlers) to your chosen canonical scheme.

For the second part, you can and should create a page rule on Cloudflare with a setting Forwarding URL, so that the canonical redirect is done by Cloudflare instead of by your origin server. For example:

image

In case you ran out of page rules and cannot afford to pay to enable extra ones, you should then set the redirect at the server level before it triggers WordPress. WordPress is what is causing the slow redirects as can be seen on the header x-redirect-by: WordPress in the first screenshot you posted.

Instead, place the redirect in your .htaccess file (if you are on a shared hosting using Apache) or equivalent configuration file. The directive to redirect from naked to www (or vice versa) must be placed before the WordPress block, so that WP is not triggered for the purpose of this redirection. You can find examples of .htaccess canonical redirects by searching on Google.

2 Likes

Thanks again – I went ahead and added the page rule and changed the canonical URL (without the www) with my hosting company. Things seem to be in much better shape now.

Cheers,

2 Likes