On 25/01/2011 23:31, Henri Gomez wrote:
>> 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);
>>    }
>> }
> 
> Any comments about this valve ?

My concerns regarding the host part remain, specifically that any
forwarded host will be ignored during the mapping process so virtual
hosting can never work. If there is only ever a single host then
Connector.proxyName / Connector.proxyPort is probably a better solution.

> FYI, it's the kind of valve required by a Tomcat behind Amazon AWS
> Load Balancer.
> I'll detail more later but the current ForwardedValve only handle
> remote (browser) information and not the local (server) address.

More details would be good. I don't see the use case for this at the moment.

Mark

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

Reply via email to