Staging websites - control availability from cloudflare?


#1

Hi! I’m pretty new to setting up web server stuff on my own. My question is: is Cloudflare the handiest way for me to manage staging a new website? By that I mean, simply enabling the staging site name and/or disabling the production name. ]I realize there’s probably a bunch of ways to do this, but since I’ve already configured Cloudflare to point to my new site and it seems to work, I’m wondering what you guys would suggest. ‘Pause Website’ in the Overview doesn’t look like it would do the trick, it just routes around Cloudflare at that point, correct? In DNS Records, looks like that might be handy, but perhaps it’s the same thing in a way, except with the records, specifically.

Suggestion(s)? Thanks Cloudflarers. : )


#2

It’s not that handy for staging sites. It’s generally handy for all sites, but it does nothing special to handle turning sites on and off.

I handle most staging on the server itself:

  1. I set up a staging subdomain, like dev.example.com, but owned by the same user as the production site. This puts both sites in the same user directory.

2a) Once I’m ready to go live, I log into the server and move/rename the directories to switch places (e.g. mv prod/public_html to prod/public_html.old and mv dev/public_html prod/public_html)

2b) Make sure all links and references to dev.example.com now point to example.com

Then use Cloudflare’s Caching tab to Clear Cache for All Files.


#3

What I do is set a page rule for the dev subdomain to bypass caching and all other optimizations.


#4

For our ENT customers we also have Host Header Overrides which allow you to send www.example.com as the host header when you type dev.example.com in the browser which can also be useful for testing which can be useful for testing 2b.

You can also use our new zone lockdown API to restrict access to your staging/dev site to protect your super secret awesome new design from prying eyes.