views:

205

answers:

2

I'm trying to run modified JWChat (a simple javascript based jabber client) on tomcat 5.5. This application is based on ajax, and uses http binding in order to communicate with the jabber server (I'm using openfire). When running it on apache server, it requires redirecting of the requests to the http-bind using mod_proxy and it works. Is there any alternative to do the same on tomcat? I tried UrlRewriteFilter, with no luck so far.

+1  A: 

Here is a pretty good writeup of available options as well as source code for a functional HTTP Proxy servlet that looks like it would meet your needs.

Tim Howland
Thanks!Actually, the worked solution was the Coldbeans' solution which is aimed exactly to that purpose of redirecting ajax requests.
Itay Pk
A: 

You could always put a transparent apache proxy in front of your web application. This has additional benefits like caching, rewriting, load-balancing, virtual host management, etc. Not saying these things can't be done by Tomcat just that apache is good at these things and well-documented.

It's much easier than you'd think, you can even combine it with your rewrite

# Proxy and Caching. Only proxy dynamic documents if this
# is the application server (or we waste disk space).
# [L] = Last rule [P] = Proxy
RewriteEngine On
RewriteRule \.(css|js|pdf|gif|jpg|png|swf|mp4|zip|exe)$ - [L]
RewriteRule (.*) http://www.yoursite.com:8000$1 [P]
CacheRoot "/var/www/cache/www.yoursite.com"
CacheSize 2000000
SpliFF