restapache-camelundertowwildfly-11

deploy rest service with camel rest DSL and undertow component to Wildfly Virtual Host


I defined a camel rest DSL service using udertow component and specified a virtual host in jboss-web.xml file but the service is always accessible trough the default virtual Host.

Jboss Undertow configuration:

         <server name="default-server">
                <ajp-listener name="ajp" socket-binding="ajp"/>
                <http-listener name="default" socket-binding="http" redirect-socket="https" enable-http2="true"/>
                <https-listener name="https" socket-binding="https" security-realm="ApplicationRealm" enable-http2="true"/>
                <host name="default-host" alias="main.virtual.host">
                    <location name="/" handler="welcome-content"/>
                    <filter-ref name="server-header"/>
                    <filter-ref name="x-powered-by-header"/>
                    <http-invoker security-realm="ApplicationRealm"/>
                </host>
                <host name="externo" alias="another.virtual.host" default-web-module=" " disable-console-redirect="false">
                    <access-log prefix="externo"/>
                    <filter-ref name="server-header"/>
                    <filter-ref name="x-powered-by-header"/>
                </host>
            </server>

Defined a rest DSL configuration as follows:

 <restConfiguration
apiContextPath="/MyServicreContextPath/api-docs"
bindingMode="json" component="undertow" contextPath="/API"
enableCORS="true" host="another.virtual.host"
port="{{http.port}}" >
    <apiProperty key="cors" value="true"/>
    <apiProperty key="api.title" value="Change Profile Service"/>
    <apiProperty key="api.version" value="1.0.0"/>
</restConfiguration>

And Defined jboss-web.xml as follows:

<jboss-web>
    <server-instance>default-server</server-instance>
    <virtual-host>externo</virtual-host>
</jboss-web>

I expect the service to be accessible only in the defined virtual host but the service is deployed to the default undertow host. The following Warn appears in the log:

WARN [org.wildfly.extension.camel] (MSC service thread 1-2) Ignoring configured host: http://another.virtual.host

Working with Camel Version 2.21.0 Jboss Eap 7.1


Solution

  • Undertow consumers will only ever be made available on the default host at present. I raised an issue to see if additional host configs could be supported.

    https://github.com/wildfly-extras/wildfly-camel/issues/2864