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

On 04/08/2015 21:56, Joakim Erdfelt wrote:
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.

That's the best suggestion so far, but can you explain how I should do it? The virtual host spec is in my jetty.xml file (I'm still using v8, but considering switching to 9, a decision which you'll no doubt applaud!) inside a block which starts with:

  <Call name="setHandler">
    <Arg>
      <New class="org.eclipse.jetty.webapp.WebAppContext">...

So, can I just follow this with another nearly-identical setHandler block but pointing at a different Descriptor and Resource-Base, and with a VH spec as follows?

  <Set name="virtualHosts">
     <Array type="java.lang.String">
        <Item>*</Item>
     </Array>
  </Set>

I gather from your answer that the default response page is hard-wired somewhere where I can't customise it easily...
--
John English


Back to the top