Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

Asynchronous Proxy Servlet

The Jetty release contains an Asychronous Proxy Servlet that may be used either as a traditional web proxy (configured in a browser) or as a transparent proxy to forward requests from a jetty server to any other server.

Proxy Server

If the Asynchronous Proxy Servlet is configured as the default servlet at the '/' path of the root context, then browsers can be configured to use the jetty server as a proxy server. The Proxy servlet will detect the proxy requests from the absolute URL in the request line and forward the request to the real server.

Transparent Proxy

A transparent proxy can proxy normal HTTP requests to another server without any special cooperation from the client.

A derived AsynchronousProxyServlet should be configured in web.xml to match the paths that are to be proxied. The AsynchronousProxyServlet itself should be extended to implement the HttpURI proxyHttpURI(final String scheme, final String serverName, int serverPort, final String uri) method to return the URI destination to which a specific request will be proxied.

The derived AsynchronousProxyServlet.Trasparent subclass exists to perform standard transparent proxy operation. Currently this class needs to be programmaticly instantiated. From 6.1.19 release, the transparent proxy will configurable with init parameters as follows:

Code Block
xml
xml
  <servlet>
    <servlet-name>GoogleProxy</servlet-name>
    <servlet-class>org.mortbay.proxy.AsyncProxyServlet$Transparent</servlet-class>
    <load-on-startup>1</load-on-startup>
    <init-param>
      <param-name>ProxyTo</param-name><param-value>http://www.google.com</param-value>
    </init-param>
    <init-param>
      <param-name>Prefix</param-name><param-value>/google</param-value>
    </init-param>
  </servlet>
  
  <servlet-mapping>
    <servlet-name>GoogleProxy</servlet-name>
    <url-pattern>/google/*</url-pattern>
  </servlet-mapping>
Contact the core Jetty developers at www.webtide.com
private support for your internal/customer projects ... custom extensions and distributions ... versioned snapshots for indefinite support ... scalability guidance for your apps and Ajax/Comet projects ... development services from 1 day to full product delivery