I would like to do a specific kind of 404 handling.  I did look for a way to do this before asking here.  I bet it's out there, I just haven't found the right search keywords.

I have a virtualhost in Apache ... it is the first virtualhost in /etc/apache2/sites-enabled, configured without ServerName or ServerAlias so it is the default virtualhost that handles any hostname that is not specified in another virtualhost.  If somebody types an incorrect hostname in a URL that happens to point at my server, Apache gives them my 404 page, without changing the URL they entered.  Examples:

https://unknown.elyograg.org/
https://rand.elyograg.org/
https://mickeymouse.elyograg.org/donaldduck

I have 404 handling in Apache as well, so if an invalid URL path is specified on a valid hostname, they also get that page.  But in those cases, it is accomplished with a redirect to https://unknown.elyograg.org, so the URL changes in the user's browser.

I would like to make it so that the presentation of the 404 page is always seamless, not a redirect.

I have haproxy in front of all my websites, and various things including Apache 2.4 on port 81 behind that.  Can haproxy do what I'm after?  Can Apache?  Can it be accomplished with some combination of configs in both?

Thanks,
Shawn


Reply via email to