> x-forwarded-proto is already handled.

Exact.

> x-forwarded-host is non-trivial since the mapping is done before the
> valve is invoked. Simpler to do the equivalent of ProxyPreserveHost On
> in the proxy.
>
> x-forwarded-port is not handled directly but x-forwarded-proto does set
> the port based on the protocol.
>
>> The fix should be easy and I could even provide the required patch.
>
> I'm not so sure it is that easy.

I've got a very basic valve for now to handle this kind of X-Forwarded
situation :


public class ForwardedValve extends ValveBase {

    public void invoke(Request paramRequest, Response paramResponse)
            throws IOException, ServletException {

        String header = paramRequest.getHeader("X-Forwarded-Host");

        if (header != null)
            paramRequest.setServerName(header);

        int header1 = paramRequest.getIntHeader("X-Forwarded-Port");

        if (header1 > 0)
            paramRequest.setServerPort(header1);

        getNext().invoke(paramRequest, paramResponse);
    }
}

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to