404 for subdomain

Is there a way that I can make a specific subdomain point to our 404 page?

If the sub-domain hostname is added to Cloudflare, therefore set to proxied :orange:, using a Page Rule, each request to sub.mydomain.com, can be redirected (301 Forwarding) to the path of your custom URL (which contains a 404 page like mydomain.com/404.html).

Another way could be using Cloudflare Workers to respond as a custom HTML page looking like “404 error” (but this could cost you up if a lot of daily requests would end up here and being served by using it).

Otherwise, you might want to setup error 404 page for your sub-domain at the origin host/server.

You can also setup a Firewall Rule to allow only your own IP address to your sub-domain and block each other request to it, or like block every request made which contains hostname like sub.yourdomain.com to your sub-domain in case of a security measurement if needed.

2 Likes

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