Using the correct header for my website!?

Hi there guys,

I’m really new to CDN and after enabling it, I read somewhere that I should use the correct headers so that I avoid serving duplicate content?
I contacted my hosting provider, (HostGator), who told me that I first need to get in touch here and then go back to them with correct headers so they can apply them, (or I could do it if given instructions).
I’m really lost here and not sure if:
a) I should bother to do this?
b) Is it somthing that I need to do or is done automatically upon enabling the cdn service?

I’m on the Free plan so far and good at following clear instructions. I searched the forum, but I’m not sure exactly what I’m looking for. All I know is that I don’t want to be serving duplicate content, if that is the case!
My site is this!

Thanks for any help on this!!

Hi Skopelos,

The issue of caching is hardly related to duplicate content. If you do a site:example.com search on Google with your domain you should see whether or not there are any duplicate pages currently being indexed.

If you navigate to your site with Dev Tools open (F12 or Ctrl-J in most browsers), and select the Network tab, you should be able to see the headers as they are being returned from your origin/Cloudflare to your browser.

Currently your static assets, such as images, JS and CSS files, are being cached by Cloudflare, which means your origin is sending the proper header (or at least not sending the wrong ones).

Static files not hosted by your origin, such as Google Fonts and other third-party files, are never cached by Cloudflare.

So your site seems to be fine as far as caching goes. You could also add a CF page rule with a Cache Level: Cache Everything setting to also cache the HTML pages, that could improve speed. But there are drawbacks as you may have dynamic content on each page that would stop being dynamic after caching. Please search this community and the Cloudflare Support KB for more details on “cache everything”.

1 Like

Hi @Floripare,
Thank you so much for your quick response and for taking the time to look through my website.
I’m relieved that things seem normal really.
I also did the ‘site:mysite’ search and it was ok.

What really threw me off in this whole process was the fact I couldn’t see cloudfare’s cdn prefix in Dev Tools, (as you suggested above), so I wasn’t even sure cdn was working. I somehow expected domain name and other assets to have that prefix in front or in between url (?)
Then through Dev tools I saw that when choosing my domain name and other assets in Response Headers I could see that ‘servers: cloudfare’ was tthere, (I presume this is since servers are pointing to cloudflare and cdn is in use).

Anyway, I then kept reading about the ‘necessary’ step of changing headers to make sure cdn wasn’t generating duplicate content, which is what started this whole search on this. I even went to live chat with hosting provider, and they told me that I needed to take the correct headers from Cloudflare so I can then implement them.
Such chaos… :slight_smile: Sorry about my ignorance. This is the 1st site I took through a cdn service, merely to test the waters. I’ve learned something in the process, so that’s cool!

I don’t think I’ll be investigating the html caching since it appears to be dynamic and don’t want to run into any more trouble with this.

Thank you very much again for your time. I really do appreciate it!!

1 Like

You’re welcome.

No, Cloudflare does not change the URL because it works as a proxy (intermediary) between visitors and your website. When visitors enter your domain they are actually making a request to a Cloudflare datacenter, and it will request from your hosting, as needed, any files it doesn’t have yet in cache.

You can check cached files by looking at the cf-cache-status header. Cached files will return a “Hit” or “Miss”, while HTML pages, without a “cache everything” page rule, will return “Dynamic”, and so on and so forth. You can also look at the Analytics in the CF dashboard to check the proportion of requests to your site that are being cached.

1 Like

Hi again Floripare,

I did thoroughly check the headers. What you’re saying makes sense and I saw it in action.
Your explanation on Cloudflare’s working as a proxy and not changing url’s makes a lot more sense now, (so I’m not panicking anymore)!

Thanks again for your time!!!

1 Like

This topic was automatically closed after 31 days. New replies are no longer allowed.