Custom pages for a sub domain

Hi Cloudflare,
I am having trouble understanding if it’s possible to setup a custom page for a subdomain.
We have xyz.abc.dk/data/ that we would like to show our users a custom page, but only if our users are entering from unspecific IP-adresses.
Can we use the Zone Lockdown feature together with custom pages? what do i need to do to accomplish this task?

Best Regards, Jack

I haven’t actually used custom pages before but my understanding is that they are domain wide error pages essentially.

I don’t think you could have custom error pages based on the subdomain. Which is what I believe you are asking?

If you want Cloudflare to host a page for you, you could use Cloudflare Pages for this instead. Don’t be scared off by the fancy complicated wording. You can totally just have normal html files and you don’t need any frameworks. You just upload the website to GitHub and have cloudflare deploy it :slight_smile:

I think this is what you’d want?

Regards,

Ben

Thanks for the suggestions, Cloudflare Pages is definetely the correct way to accomplish this.
However just to follow up on my own question, i actually made it work yesterday evening. This way is more low key, and could be used to serve a specific error page during scheduled maintenance for a non critical site.

I made it work, using The Zone Lockdown. Go to Firewall → Zone Lockdown. Create a ruleset, i.e. which subdomain/domain/path you want to lockdown, and specify a set of whitelisted IP-adresses, be aware this a whitelist not a blacklist :slight_smile: It’s also possible to locksown your whole domain this way.
Now go to Custom Pages, and set up the Class 1000 error and the IP/Country Blocking with your own specific maintenance page or error page, this can temporary be hosted through Github Pages, at least that worked for me, use the correct tokens

<h2 style="display:none;">::CLOUDFLARE_ERROR_1000S_BOX::</h2>
<h2 style="display:none;">::GEO::</h2>
<h2 style="display:none;">::CLIENT_IP::</h2>

There are several turotials here on Cloudflare community, where you can find some basic html that work with Custom Pages, just insert the above tokens :+1: Furthermore Cloudflare pages does allow inline css and JS, I was able to make an animated site hosting just a simple html page through Github pages.

  • Jack

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.