1 of 1 people found this helpful
Stephen Kay wrote:
I would like to serve the same war deployed on standalone on 2 different ports, e.g. both localhost:8080 and 8081.
Is it possible to tweak some handlers / whatever with Undertow to get this result ?
Simple, just add another http-listener with different socket binding for port 8081
how can I define the default-web-module in the virtual server configuration ?
host element has default-web-module attribute....
example of full blown configuration we use for testing https://github.com/wildfly/wildfly/blob/master/undertow/src/test/resources/org/wildfly/extension/undertow/undertow-1.1.xml
also take a look into subsystem's xsd schema you can find in docs/schema/ of your distro.
or if you work via CLI take a look at http://wildscribe.github.io/Wildfly/8.0.0.Final/subsystem/undertow/index.html for model description.
Thank you very much for sharing your work : you are anticipating solutions with a very good example of Undertow / should be referenced through official documentation !.
According to your sample, this is what I added to standolone.xml :
<http-listener name="default2" socket-binding="http2" />
<host name="default-host2" alias="localhost2" default-web-module="engine.war">
<location name="/" handler="welcome-content"/>
<filter-ref name="server-header" />
<socket-binding name="http2" port="8081" />
The socket binding is OK : engine.war is accessed through 8080 and 8081 ; and second host configuration / default.web-module precision is unuseful for just this need
I'm still puzzled with the second host headers configuration.
As you can see in my default-host2, I removed the
<filter-ref name="x-powered-by-header" />
But I can see the header on both accesses : 8080 and 8081.
If I remove that header on host name="default", this is impacting both accesses 8080 and 8081.
The question is how / is it possible / to link the host filter-ref configuration to the socket-binding.