Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] Customizing 404 response for virtual hosts

With virtual hosts, the webapp's WEB-INF/web.xml and its <error-page> will be relevant only if the host matches.

But you need a webapp on root that isn't attached to a virtualhost configuration
One technique would be to have something small/tiny that just responds to requests that don't match the incoming virtual host.


Joakim Erdfelt / joakim@xxxxxxxxxxx

On Tue, Aug 4, 2015 at 10:22 AM, Steve Sobol - Lobos Studios <steve@xxxxxxxxxxxxxxxx> wrote:
If it's a traditional Web app, the <error-page> Web.xml directive is what you're looking for.


-- 
Lobos Studios - Website and Mobile App Design & Development; IT Support; Computer Maintenance
Toll Free  877.919.4WEB - Apple Valley 760.684.8859 - Los Angeles 310.945.2410 - Cleveland 216.242.4010
www.LobosStudios.com * www.facebook.com/LobosStudios * @LobosStudios


On Aug 4, 2015, at 09:49, Joakim Erdfelt <joakim@xxxxxxxxxxx> wrote:

Is your webapp a traditional WAR file with a WEB-INF/web.xml or a jetty embedded setup?

Joakim Erdfelt / joakim@xxxxxxxxxxx

On Tue, Aug 4, 2015 at 4:39 AM, John English <john.foreign@xxxxxxxxx> wrote:
I asked this a few days ago; would have thought it's an easy one, but no-one's responded; maybe it's not so easy, or maybe I wasn't clear enough. So I'll try again.

I have a webapp in the root context of my server (which, incidentally, has its own customized 404 handler). The webapp uses a virtual host list:
  <Set name="virtualHosts">
     <Array type="java.lang.String">
        <Item>foo.bar.com</Item>
        <Item>127.0.0.1</Item>
     </Array>
  </Set>

This works fine, and allows connections to foo.bar.com and 127.0.0.1, and if I try connecting to it via an address which is not in the list I get a standard 404 response which says:

HTTP ERROR: 404
Problem accessing /. Reason:
    Not Found
Powered by Jetty://

I would like to customize this response. I've RTFM'ed, but all I've found is the section on "Server level 404 error" whose only advice is "Create a "root" web app mapped to the "/" URI" which is advice for a quite different problem (and I already have a root webapp mapped to "/").

So can anyone tell me what I need to do to customize this response?

TIA,
--
John English
_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-users

_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-users

_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-users


Back to the top