Prudence
The Scalable REST/JVM
Web Development Platform

Creative Commons License

HTTP Proxy

There's nothing special about how Prudence handles HTTP, and it can work easily behind any reverse proxy. This lets you easily unite Prudence with other web servers or run it behind a load balancer. Though it's not unique to Prudence, we thought to add this section to the manual in order to get you up and running quickly with this useful scenario.

Apache

Apache's HTTP server is often called the "Swiss army knife of the Internet" for how well it manipulates URLs and routes HTTP requests. Prudence already does powerful URI-based routing, including virtual hosting, meaning that you probably won't need Apache for that.
Where you might want to use Apache is as a container environment for other application platforms, such as mod_php and mod_wsgi. If you have no choice but to run Apache as your front end, it is straightforward to set it to route to Prudence via reverse proxy.
Here's a sample Apache configuration that proxies all URLs beginning with "/prudence/" to a local Prudence instance running at the default server port. For demonstration purposes, we'll also explicitly block proxying of "/prudence/images/" URLs so that Apache would handle serving them (from directory /var/www/prudence/images) instead of Prudence. Though, note that Prudence can serve static files just fine. Apache's mod_proxy and mod_proxy_http must be enabled for this configuration to work:
<VirtualHost *:80>
	DocumentRoot /var/www
​
	<Proxy *>
		Order deny,allow
		Allow from all
	</Proxy>
​
	ProxyRequests Off
	ProxyPreserveHost On
	ProxyStatus On
​
	# Note that the order of ProxyPass statements matters
	ProxyPass /prudence/images/ !
	ProxyPass /prudence/ http://localhost:8080/ retry=0 
</VirtualHost>