Document.txt instead of 404 error Page

1. The problem I’m having:

I try to allow only specific subdomains. I wish to output a 404 or other error message. But if I try this, my iOS Device with chrome does only output a empty document file and no error or site not found page. Only with a static HTML page the output is ok, but so I have a 200 HTTP Code. What is the best solution for this?

*.domain1.com {
    @app1 host app1.domain1.com
    handle @app1 {
        reverse_proxy localhost:8001
        # or: reverse_proxy 192.168.1.100:8001
    }
    
    @app2 host app2.domain1.com
    handle @app2 {
        reverse_proxy localhost:8002
    }
    
    handle {
        respond 404
    }
}

2. Error messages and/or full log output:

Chrome on a iOS Device download a document file instead of showing an 404 error page or other eror page

3. Caddy version:

v2.10.2 h1

4. How I installed and ran Caddy:

Proxmox Helper Script

a. System environment:

cat /etc/debian_version

12.12

5. Links to relevant resources:

HTTP 404 is what you’re telling Caddy to tell the client, if they ask for other than your specific subdomains.

That error is usually an empty page, with some browser showing their own custom error page.

Your setup behaves exactly as configured and I do not see any problems in the configuration.

If you are asking about something else, please share some curl examples of what you’re getting and what you should be getting.

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