title: Create a reverse proxy by littleproxy
body: <p>I'm a beginner with <code>littleproxy</code>, how can I create a reverse proxy server?</p>
  
  <p>My proxy get requests from clients and sends them to servers (servers only a regular site same as www.xxx.com contain only web page(in not rest) and proxy get response from server(a web page) and return to client. </p>
  
  <p>For example, client url is <code>localhost:8080/x</code>, proxy maps it to <code>www.myserver.com/xy</code> and shows <code>xy</code> page for client. How can do it by using a filter or a httpservlet. </p>
  
  <p>My http servlet will be as follow: </p>
  
  <pre><code> public class ProxyFilter implements Filter {
        public void doFilter(ServletRequest req, ServletResponse res,
              FilterChain chain) throws IOException, ServletException {
  
          HttpServletRequest request = (HttpServletRequest) req;
  
          HttpProxyServer server =
          DefaultHttpProxyServer.bootstrap()
          .withPort(8080)
          .withFiltersSource(new HttpFiltersSourceAdapter() {
              public HttpFilters filterRequest(HttpRequest originalRequest, ChannelHandlerContext ctx) {
                 return new HttpFiltersAdapter(originalRequest) {
                    @Override
                    public HttpResponse clientToProxyRequest(HttpObject httpObject) {
                        // TODO: implement your filtering here ????
                        return null;
                    }
  
                    @Override
                    public HttpResponse proxyToServerRequest(HttpObject httpObject) {
                        // TODO: implement your filtering here ????
                        return null;
                    }
  
                    @Override
                    public HttpObject serverToProxyResponse(HttpObject httpObject) {
                        // TODO: implement your filtering here ????
                        return httpObject;
                    }
  
                    @Override
                    public HttpObject proxyToClientResponse(HttpObject httpObject) {
                        // TODO: implement your filtering here ????
                        return httpObject;
                    }   
                 };
              }
          })
          .start();
      }
      public void init(FilterConfig config) throws ServletException {
  
      }
      public void destroy() {
  
      }
  }
  </code></pre>