[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [jetty-users] Customizing 404 response for virtual hosts
|
On 06/08/2015 13:25, John English wrote:
It would appear from my experiments that when there are multiple
"setHandler" blocks defining webapps all mapped to "/", the last one
wins if the virtual host lists are not disjoint. If I have one accepting
127.0.0.1 (A) and another without a VH list (B), specifying A then B
means that B always responds. If I reverse the order (B then A), A
accepts 127.0.0.1 correctly, but generates a default 404 page for
127.0.0.2 rather than invoking B.
Since no-one has been able to tell me how to solve my problem, I've
eventually stopped using virtual hosts completely due to the apparent
inability of Jetty to let you customise the 404 response to an invalid
hostname, and instead I have added a filter to the servlet chain that
inspects the hostname before honoring the request, and then if it's not
in the aproved hostname list I can process it however I like. Clunky,
but it has the advantage of actually working.
Maybe it's different in Jetty 9 (I plan to upgrade soon, promise) but
once again the docs don't cover this particular problem so I'm not that
optimistic it'll be any easier.
--
John English