Configuring Jetty Servlet Proxy

Sample application can be downloaded from here

Lets say you deploy app1, app2, someotherapp to devhost:3000 and testhost:3000 then those apps can be accessed as follows

DEV instances

TEST instances

Many a times one application depends upon other applications with in the same server and hence, your application may contain code snippets as follows

<link title="Stylesheet" href="/someotherapp/style.css" rel="stylesheet" media="screen" type="text/css" />

further those can be directly accessed as well


Further Jetty is the best choice for local development either embedded or using jetty-maven-plugin

In this case it does not make sense to replicate the entire environment locally, instead those urls can be proxied in local environment such that /someotherapp/style.css would be proxied to http://devhost:3000/someotherapp/style.css

Here is how you can achieve it.

1) Map ProxyServlet.Transparent to /someotherapp/*
2) Set the Servlet init parameters as follows
ProxyTo ==> http://devhost:3000/someotherapp
Prefix ==> /someotherapp

The above two steps can be done in two ways

Configuring using Java

Configuring using maven jetty plugin

			<connector implementation="org.eclipse.jetty.server.nio.SelectChannelConnector">



One thought on “Configuring Jetty Servlet Proxy

  1. Pingback: iQSpot's kitchen – Simple Reverse Proxy in Jetty JAR install

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s