[undertow-dev] Undertow responding to unknown host

Tomaž Cerar tomaz.cerar at gmail.com
Tue Feb 17 07:40:59 EST 2015


Hi,

this is more disscussion for wildfly forums but anyhow....

"default-host" is configured as default and as such all non otherwise
matching host will end up being served by default host.

you could add another host and which will be used only when host matches
the one you want  or add extra host and make it default

an example what you could do:

<server name="default-server" *default-host="other-host"*>
                <http-listener name="default" socket-binding="http"/>
                <host name="default-host" alias="localhost">
                    <location name="/" handler="welcome-content"/>
                    <filter-ref name="server-header"/>
                    <filter-ref name="x-powered-by-header"/>
                </host>
                <host *name="other-host"* alias="some.other.host,
some.alias">
                    <filter-ref name="server-header"/>
                    <filter-ref name="x-powered-by-header"/>
                </host>
            </server>

Just keep in mind that if using non-default host, you need to tell your
application to use it by adding jboss-web.xml with
<virtual-host>name-of-other-host</virutal-host>

--
tomaz



On Tue, Feb 17, 2015 at 10:05 AM, Guruprasad Nagaraj <gpn at networkart.com>
wrote:

>  Hi,
> I am using Wildfly 8.2 Final.
> I am using the default Undertow subsystem configuration -
>
>          <subsystem xmlns="urn:jboss:domain:undertow:1.2">
>             <buffer-cache name="default"/>
>             <server name="default-server">
>                 <http-listener name="default" socket-binding="http"/>
>                 <host name="default-host" alias="localhost">
>                     <location name="/" handler="welcome-content"/>
>                     <filter-ref name="server-header"/>
>                     <filter-ref name="x-powered-by-header"/>
>                 </host>
>             </server>
>             <servlet-container name="default">
>                 <jsp-config/>
>                 <websockets/>
>             </servlet-container>
>             <handlers>
>                 <file name="welcome-content"
> path="${jboss.home.dir}/welcome-content"/>
>             </handlers>
>             <filters>
>                 <response-header name="server-header" header-name="Server"
> header-value="WildFly/8"/>
>                 <response-header name="x-powered-by-header"
> header-name="X-Powered-By" header-value="Undertow/1"/>
>             </filters>
>         </subsystem>
>
>  As you see I do not have any aliases apart from the localhost.
>
>  I have a local DNS entry which points acme.example.com to the IP Address
> of the Wildfly Server/Host.
>
>  When I try to fetch a page http://acme.example.com:8080/SVWeb/index.html,
> I do get the page back. While undertow does not know about this host, how
> is it that I get the content back?
> The Host header in the HTTP request is indeed -
> Host: “acme.example.com:8080"
>
>  Should I use any filters or access control to let Undertow know not
> serve unknown hosts?
>
>          Thanks and Best Regards,
> GPN
>
>
> _______________________________________________
> undertow-dev mailing list
> undertow-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/undertow-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/undertow-dev/attachments/20150217/9ff390e9/attachment-0001.html 


More information about the undertow-dev mailing list