6 Replies Latest reply on Apr 17, 2017 6:06 AM by valsaraj viswanathan

    Reverse Proxy

    Pablo Aviles Newbie


      How do I configure a reverse proxy using Wildfly?

        • 2. Re: Reverse Proxy
          Pablo Aviles Newbie

          Thank you, but I am not quite sure where that configuration should go...

          • 3. Re: Re: Reverse Proxy
            Radoslav Husar Master

            Open standalone.xml (or standalone-ha.xml) and look for the Undertow subsystem section.

             

            The bold lines will add on default host on / location a reverse proxy handler for a domain example.com:

             

                    <subsystem xmlns="urn:jboss:domain:undertow:1.0">

                        <buffer-caches>

                            <buffer-cache name="default" buffer-size="1024" buffers-per-region="1024" max-regions="10"/>

                        </buffer-caches>

                        <server name="default-server">

                            <ajp-listener name="ajp" socket-binding="ajp"/>

                            <http-listener name="default" socket-binding="http"/>

                            <host name="default-host" alias="localhost">

                                <location name="/" handler="reverse-proxy"/>

                                <filter-ref name="server-header"/>

                                <filter-ref name="x-powered-by-header"/>

                            </host>

                        </server>

                        <servlet-container name="default" default-buffer-cache="default" stack-trace-on-error="local-only">

                            <jsp-config/>

                        </servlet-container>

                        <handlers>

                            <file name="welcome-content" path="${jboss.home.dir}/welcome-content" directory-listing="true"/>

                            <reverse-proxy name="reverse-proxy" connections-per-thread="30">

                                <host name="http://www.example.com:80" instance-id="myRoute"/>

                            </reverse-proxy>

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

            1 of 1 people found this helpful
            • 4. Re: Reverse Proxy
              Pablo Aviles Newbie

              Thank you for the response, I am getting an error 500 when opening localhost:8080

              • 5. Re: Reverse Proxy
                Radoslav Husar Master

                Pablo Aviles wrote:

                 

                Thank you for the response, I am getting an error 500 when opening localhost:8080

                You need to specify the scheme. Correct value would be "http://localhost:8080". Otherwise you will see in the log:

                 

                10:32:36,877 ERROR [io.undertow.request] (default I/O-1) Blocking request failed HttpServerExchange{ GET /}: java.lang.IllegalArgumentException: UT001031: Unknown scheme in URI localhost:8080

                1 of 1 people found this helpful
                • 6. Re: Reverse Proxy
                  valsaraj viswanathan Master

                  Me too got same with http2.