Igor Kromin |   Consultant. Coder. Blogger. Tinkerer. Gamer.

CloudFlare is a fantastic service and as I was moving one of my sites to use CloudFlare this weekend I wanted to know for sure if it was being served via the CloudFlare network or still from my web server. With a little bit of curl and looking at some HTTP headers this is very easy thing to check.

The following command will display all header information for a request to the site:
 cURL
curl -sI https://yourwebsite.domain


The output looks similar to this when your site is not on CloudFlare, of course this will vary from server to server, the main point is there aren't any CloudFlare specific headers present:
 HTTP headers without CloudFlare
HTTP/1.1 200 OK
Date: Mon, 17 Apr 2017 07:03:58 GMT
Expires: Mon, 17 Apr 2017 07:13:58 GMT
Cache-Control: public, max-age=600
ETag: "OVVDww"
X-Cloud-Trace-Context: 4bc589fab4a319f41fb7aa2eeb7fcf81
Content-Type: text/html
Server: Google Frontend
Content-Length: 8714




Now once the site (or rather the DNS) switches over to CloudFlare the headers change to something like this...
 HTTP headers with CloudFlare
HTTP/1.1 200 OK
Date: Mon, 17 Apr 2017 07:04:14 GMT
Content-Type: text/html
Connection: keep-alive
Set-Cookie: __cfduid=d4161c4f0a3ddd95b561a8921dccecebf1492412654; expires=Tue, 17-Apr-18 07:04:14 GMT; path=/; domain=.yourwebsite.domain; HttpOnly
Expires: Mon, 17 Apr 2017 07:14:14 GMT
Cache-Control: public, max-age=600
X-Cloud-Trace-Context: d1a32aaff5d361cdfec9fd1e9cacaf57
Server: cloudflare-nginx
CF-RAY: 350d87709c3632a1-HKG


Specifically these are the new headers specific to CloudFlare...
 HTTP headers with CloudFlare
Set-Cookie: __cfduid=d4161c4f0a3ddd95b561a8921dccecebf1492412654; expires=Tue, 17-Apr-18 07:04:14 GMT; path=/; domain=.yourwebsite.domain; HttpOnly
Server: cloudflare-nginx
CF-RAY: 350d87709c3632a1-HKG


Out of all those new headers we only really care about the value for the Server header, so the following command is what we're really after:
 cURL
curl -sI https://yourwebsite.domain | grep Server


Running that produces the following output and you can clearly see that the CloudFlare nginx server is being used to deliver your site's content.
 HTTP headers with CloudFlare
Server: cloudflare-nginx


-i

A quick disclaimer...

Although I put in a great effort into researching all the topics I cover, mistakes can happen. Use of any information from my blog posts should be at own risk and I do not hold any liability towards any information misuse or damages caused by following any of my posts.

All content and opinions expressed on this Blog are my own and do not represent the opinions of my employer (Oracle). Use of any information contained in this blog post/article is subject to this disclaimer.
Hi! You can search my blog here ⤵
NOTE: (2022) This Blog is no longer maintained and I will not be answering any emails or comments.

I am now focusing on Atari Gamer.