Igor's Blog

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

, , ,
About — I'm an enthusiastic software engineer and consultant interested in many fields including J2EE, programming, electronics, 3D printing, video games, wood working and gardening.
See my Resume for more information.
The views expressed in this blog are my own and not those of my employer.
comments powered by Disqus
My other posts you may like...
Programming, DIY, Games, Hacks, Tech and more.
Follow me on...
Current and Past Projects
See my Resume

Subscribe


RSS Feed

My Other Web Sites

Igor and Elise's Travels
Riverside Expressway Cam
300 George St Blogumentary

My Online Tools

UUID to OID Converter
Guru JSON-RPC Tester
Extrudifier Object Designer
Travel ┬ÁBlog

Recent Blog Posts

How to install Panel Glide Blinds from Blinds Online

Showing whitespace characters in vi

Using Jackson to automatically convert Java POJOs to JSON as output of a Jersey service

Enable quick access to the keyboard and emoji viewer in macOS

How to tell if your site is served via CloudFlare

Googe Cloud Platform doesn't support CloudFlare's free edge certificates

Fixing the invalid private key error in the Google Cloud Platform App Engine app Settings page

Cleaning the sticky PlayStation controller analogue thumb sticks

Invoking interactive shell scripts non-interactively

Using variables as column numbers with Bash and Awk when processing text files

Recent Galleries

Space Food - Chocolate Ice Cream with Chocolate Chips

Legeod Star Wars AT-DP kit

DIY spare parts computer build with a RAIDMAX Anura case

Fake 'Lepin' brand Lego packaging

Hardwood garden bench with clear resin void filler

Fixing a 3D printer extruder that stopped heating up

Easily increase disk space in a Lenovo Ideapad 100S 14" laptop with an M.2 SSD

Making a multi-piece 3D printed solder spool holder stand

DIY indoor apartment grow light wiring

Good Friday Electronics fun Easter Bunny LED PCB Kit IBEABU-01.0

Top Categories

Blogs I follow

Matt Moores Blog
Georgi's FlatPress Guide
Perplexing Permutations
The Security Sleuth

Friends

RAWS Parts Online
Alpha Dimensions Hosting
Kristensen Photography
Ilia Rogatchevski
Travelling Fairy

Blog Activity

Blog Activity
Follow me on... 
     
...or subscribe for updates!

Don't show this again