使用骆驼休息 DSL 和 undertow 组件部署 rest 服务到 Wildfly 虚拟主机



我使用 udertow 组件定义了一个 camel rest DSL 服务,并在 jboss-web.xml 文件中指定了一个虚拟主机,但该服务始终可以通过默认虚拟主机访问。

Jboss Undertow 配置:

<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>

定义静态 DSL 配置,如下所示:

<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>

并定义 jboss-web.xml如下:

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

我希望该服务只能在定义的虚拟主机中访问,但该服务已部署到默认的暗流主机。 日志中出现以下警告:

警告 [org.wildfly.extension.camel] (MSC 服务线程 1-2( 忽略配置的主机:http://another.virtual.host

使用 Camel 版本 2.21.0 Jboss Eap 7.1

Undertow 使用者目前只能在默认主机上使用。我提出了一个问题,以查看是否可以支持其他主机配置。

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

最新更新