2

I configured LitteProxy as a reverse proxy and trying to implement a filter. When I send a HTTP GET , the clientToProxyRequest filter adapter is called twice. Once with DefaultHttpRequest as httpObject and the second time with LastHttpContent. It can be something to do with chunks ? How do I do this right ?

HttpProxyServerBootstrap bs = DefaultHttpProxyServer.bootstrap();
    //reverse proxy
    bs.withAllowRequestToOriginServer(true);

Filter is created as :

new HttpFiltersAdapter(originalRequest) {
        @Override
       public HttpResponse clientToProxyRequest(HttpObject httpObject) {
            //doing filtering here..
            return null;
       }
}
Ramp
  • 1,772
  • 18
  • 24
  • After some debugging, I filter the http request only if they are an instance of HttpRequest , something like : if (httpObject instanceof HttpRequest) { //filter }. Works as expected so far but not sure if there is a better way. – Ramp Apr 26 '17 at 11:19

0 Answers0