Search code examples
url-rewritingwildfly-8undertow

URL Rewriting using undertow file handler


I'm currently trying to use an URL rewrite for content I delivered via a file handler from local file system. There doesn't seems to be a documentation and/or functionality for this. I guess I would work fine using a war file (as answered in this forum https://developer.jboss.org/message/915980) but unluckily this does not work for my stuff.

My configuration looks like this

<server name="default-server">
    <http-listener name="default" socket-binding="http" max-post-size="51200000" max-parameters="10000"/>
    <https-listener name="https" socket-binding="https" max-post-size="51200000" max-parameters="10000" security-realm="UndertowRealm"/>
    <host name="default-host" alias="localhost">
        <location name="/" handler="welcome-content"/>
        <access-log rotate="true"/>
        <filter-ref name="server-header"/>
        <filter-ref name="x-powered-by-header"/>
        <filter-ref name="connection"/>
    </host>
</server>
<servlet-container name="default">
    <jsp-config/>
</servlet-container>
<handlers>
    <file name="welcome-content" path="C:/path/to/private/docroot"/>
</handlers>

I tried to rebuild my docroot, that it looks like an exposed .war file, so I could add a WEB-INF/undertow-handler.conf file, containing the simply following rule:

regex['/Deploy/stuff/laptop/windows/(.*)/update.xml'] -> rewrite['/Deploy/stuff/laptop/windows/new-update.xml']

but this file and/or rule seems to be plainly ignored.

Any help is greatly appreciated.


Solution

  • It should be undertow-handlers.conf, with an s.