Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] How to Jetty server listen on multiple IP addresses

Hi,

On Mon, May 15, 2023 at 8:16 PM Wang Yicheng <wangyicheng1209@xxxxxxxxx> wrote:
>
> Hi Simone,
>
> I'm chasing the same problem as the original post. And inspired by Uwe's reply, I managed to get it to work by duplicating the "connector" instantiation code in jetty-ssl.xml and creating 2 jetty-https.xml files (please see my detailed steps below). This seems to work perfectly, but I'm just curious about how my solution differs from yours. Is better encapsulation the only difference here by creating a customized module? Many thanks in advance!
>
> 1. Copy over jetty-ssl.xml from ${JETTY_HOME}/etc to${JETTY_BASE}/etc
> 2. Duplicate the “addConnector” block so that 2 connectors will be created
> 3. Copy over jetty-https.xml from ${JETTY_HOME}/etc to ${JETTY_BASE}/etc
> 4. Duplicate jetty-https.xml to correspond to the 2 connectors. Say the second XML is named as jetty-https-2.xml
> 5. Update the connector ID field in jetty-https.xml files accordingly
> 6. Add jetty-https-2.xml to ${JETTY_BASE}/start.d/https.ini

I'm not sure what you mean by bullet 6... how do you add the XML to
the *.ini file?
You meant *.mod?

Rather than modifying existing Jetty files, I would just create a new
module with a different name.
I would copy `jetty-ssl.xml` and `jetty-https.xml` into another file
called, say, `acme-extra-ssl.xml`.
Then create a module called `acme-extra-ssl.mod`, referencing the new XML.
And then start Jetty with the new module.
Writing a new module is simple, follow:
https://www.eclipse.org/jetty/documentation/jetty-11/operations-guide/index.html#og-modules-custom

Suggestions about improving the documentation, if not clear, are welcome.

This allows you to not mess with the Jetty default modules, which
would be surprising 6 months from now ("why is there a copy of
jetty-https.xml in $JETTY_BASE?!? that should not be needed!").

-- 
Simone Bordet
----
http://cometd.org
http://webtide.com
Developer advice, training, services and support
from the Jetty & CometD experts.


Back to the top