Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] Virtual host proxy problems

On 26/12/2017 21:13, Simone Bordet wrote:
Hi,

On Tue, Dec 26, 2017 at 6:06 PM, John English <john.foreign@xxxxxxxxx> wrote:
3) Requests to https://www.foo.com go to the primary webapp as expected.
Requests to https://www.bar.com result in an empty 502 response ("Bad
Gateway").

Can anyone suggest what might be going wrong here in case (3)?

I would verify that you don't have a bad /etc/hosts on your local
machine, resolving bar.com to some address you don't expect.

Nope.

Also, you did not report the Jetty configuration where you have setup
your virtual hosts.

In my "webapps" directory, I have directories for the primary webapp, default webapp and proxy webapp, with corresponding primary.xml, default.xml and proxy.xml. In primary.xml I have this:

<Configure class="org.eclipse.jetty.webapp.WebAppContext">
  <Set name="contextPath">/</Set>
<Set name="war"><Property name="jetty.webapps" default="."/>/primary</Set>
  <Set name="virtualHosts">
    <Array type="java.lang.String">
      <Item>www.foo.com</Item>
      <Item>192.168.1.200</Item>
      <Item>127.0.0.1</Item>
    </Array>
  </Set>
</Configure>

In proxy.xml I have this:

<Configure class="org.eclipse.jetty.webapp.WebAppContext">
  <Set name="contextPath">/</Set>
  <Set name="war"><Property name="jetty.webapps" default="."/>/proxy</Set>
  <Set name="virtualHosts">
    <Array type="java.lang.String">
      <Item>www.bar.com</Item>
      <Item>192.168.1.201</Item>
      <Item>127.0.0.2</Item>
    </Array>
  </Set>
</Configure>

My default.xml is a catch-all for all other domain names or IP addresses, which just responds with a 404 to all requests.

<Configure class="org.eclipse.jetty.webapp.WebAppContext">
  <Set name="contextPath">/</Set>
<Set name="war"><Property name="jetty.webapps" default="."/>/default</Set>
</Configure>

Enabling DEBUG logging for the "org.eclipse.jetty" category is very
verbose but sometimes understandable enough also by users like you to
figure out what's wrong.

OK, I'll give it a whirl. Thanks.

--
John English


Back to the top