"roll your own" Proxypass for http-bind: will this work?

Hi,

We wish to write our own proxy pass servlet to allow jsjac to access both normal tomcat stuff as well as the openfire http binding. (Browsers forbids javascript from accessing multiple combination of host/port)

To clarify, the servlet will function like ‘proxypass’ does with Apache, i.e. http://server:80/xmpp to http://jabberserver:8080/http-bind/

I have a basic question: Can simple forwarding via apache commons http client library work? i.e. do we need to do anything extra-steps/issue to ensure this proxying works for BOSH/xmpp?

thanks,

bill m

An update: The proxy servlet HttpProxyServlet.java here represents a good start, but does not quite work. http://edwardstx.net/wiki/Wiki.jsp?page=HttpProxyServlet

It has two problems.

First, it must copy the body of the request into the “proxied request”. Simply copying the request parameters/values results in an empty post.Thus I had to add this code at the end of the ‘doPost’ method to copy the request body into the proxied request body.

code:

RequestEntity entity = new InputStreamRequestEntity(httpServletRequest.getInputStream());

postMethodProxyRequest.setRequestEntity(entity);

Second, I end up with a ‘403 forbidden error’. My jsjac based web-client logs in fine initially then receives presence messages, but then receives a 403 forbidden error. I do not know why. I have attached a wireshark “tcp follow” dump.

request:

<body rid=‘397954’ sid=‘5d4cc67a’ xmlns=‘http://jabber.org/protocol/httpbind’ key=‘aec97a9e92803133f500fa7f6fdebec2700a0941’ />

response:

HTTP/1.1 403 Forbidden

The same jsjac client works fine with the JabberHttpBind servlet. It does not work with jsjac-proxyservlet-Openfire httpbind combination.

I do not understand if the proxy needs “more fanciness” --i.e. proxypassreverse functionality, for example.

Follow on questions:

  1. Why/where does http-bind servlet throw a 403 errro?