No such site at :80 404 redirect


I have encountered a situation that probably doesn’t come up a bunch and I am trying to work with Caddy to resolve the 404.

The situation:
I have a static ip that I purchased and it has been around the block a lot. That being said, there are dns servers with dns names that are tied to this ip address. Since I only have one domain behind this address whenever someone tried to go to these domain names behind this static address it gives the 'no such site at :80 404" which is working as intended. What I want to do is forward any of these unknow dns tld names to a generic 404 page. I can do this within my registerd domain name and it works fine, but how can I have a catch all or drop through for any of these dns names that I don’t know?

(I would rather send them to a clean 404 page so they can be informed that this site is not hosted on this server)

Current Caddy File: {
root /var/www/
errors {
404 /var/www/
500 /var/www/
502 /var/www/

  • {
    errors {
    * /var/www/

Thank you for any help!

Hi @maro,

What you’ll want to implement is a catch-all / fallback / generic site definition, to handle any HTTP request.

Since it won’t 404 automatically anymore (you’re providing a real site response for these requests), we manually set the 404 for the entire catch-all site, then internally rewrite to the document you want to use for your error page.

http:// {
  status 404 /
  rewrite {
    to 404.html

The way Caddy’s site matching works, this definition will handle requests for any site that you haven’t specifically put in your Caddyfile.

The end result is that visitors to unconfigured hostnames on your server receive HTTP 404 with the content of the 404.html document.

1 Like

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