QUESTION: How to set a reverse proxy with Undertow

Posted on

I need to configure Undertow to work as a reverse proxy. Its a laboratory experience and security is not important right now. i have a domain, mydomain.com e its correctly pointed to my public ip adress. I want to acess the welcome page of wildfly and then management console. With nginx was super easy, but i really want to do it with Undertow. It must be Undertow. Im self-taught guy and you already know that im a oob, avery curious and obssessed one. My latest atempt, it did not work. the error says: WFLYCTL0193: Failed executing subsystem undertow boot operations.

  <subsystem xmlns="urn:jboss:domain:undertow:14.0" default-virtual-host="default-host" default-servlet-container="default" default-server="default-server" statistics-enabled="${wildfly.undertow.statistics-enabled:${wildfly.statistics-enabled:false}}" default-security-domain="other">
        <byte-buffer-pool name="default"/>
        <buffer-cache name="default"/>
        <server name="default-server">
            <http-listener name="default" socket-binding="http" redirect-socket="https" enable-http2="true"/>
            <https-listener name="https" socket-binding="https" ssl-context="applicationSSC" enable-http2="true"/>
            <host name="default-host" alias="localhost">
                <location name="/" handler="reverse-proxy"/>
                <filter-ref name="server-header"/>
                <filter-ref name="x-powered-by-header"/>
                <http-invoker http-authentication-factory="application-http-authentication"/>
            </host>
        </server>
        <servlet-container name="default">
            <jsp-config/>
            <websockets/>
        </servlet-container>
        <handlers>
            <file name="welcome-content" path="${jboss.home.dir}/welcome-content"/>
            <reverse-proxy name="reverse-proxy" connections-per-thread="30">
            <host name="default-host"/>
        </reverse-proxy>
        </handlers>
        <filters>
            <response-header name="server-header" header-name="Server" header-value="Wildfly 31"/>
            <response-header name="x-powered-by-header" header-name="X-Powered-By" header-value="Undertow 14"/>
        </filters>
        <application-security-domains>
            <application-security-domain name="other" security-domain="ApplicationDomain"/>
        </application-security-domains>
    </subsystem>

<socket-binding-group name="standard-sockets" default-interface="public" port-offset="${jboss.socket.binding.port-offset:0}">
    <socket-binding name="ajp" port="${jboss.ajp.port:8009}"/>
    <socket-binding name="http" port="${jboss.http.port:8080}"/>
    <socket-binding name="https" port="${jboss.https.port:8443}"/>
    <socket-binding name="management-http" interface="management" port="${jboss.management.http.port:9990}"/>
    <socket-binding name="management-https" interface="management" port="${jboss.management.https.port:9993}"/>
    <socket-binding name="txn-recovery-environment" port="4712"/>
    <socket-binding name="txn-status-manager" port="4713"/>
    <outbound-socket-binding name="mail-smtp">
        <remote-destination host="${jboss.mail.server.host:localhost}" port="${jboss.mail.server.port:25}"/>
    </outbound-socket-binding>
    <outbound-socket-binding name="reverse-proxy-outbound">
        <remote-destination host="default-host" port="9990"/>
    </outbound-socket-binding>        
</socket-binding-group>

Responses