Apache Http server as proxy for vert.x applications/ Use Vert.x as proxy for underlying applications

653 views
Skip to first unread message

Jens Laufer

unread,
Nov 20, 2012, 9:23:18 AM11/20/12
to ve...@googlegroups.com
I have different (classical) webapps running on Tomcats, which run on different ports.
In front I am running a Apache Webserver passing the requests to the tomcats through (mod_jk).
Apache httpd is running on port 80. 
Well my idea was, to write some web applications with vert.x running on another available port and reuse the Apache proxy.
I played around a little bit with mod_proxy on Apache. That works fine as long I don't use socketjs/eventbus stuff in the vertx-webapp.
But using that is essential to me, because the eventbus is a hot feature.
So how do i solve that problem?

Is it even possible to replace the Apache httpd with vertx-proxy listening to port 80 passing the requests to the tomcat/vert.x applications.
Is this a good idea? Or is there another possibilty?

Thx. 

Brian Lalor

unread,
Nov 20, 2012, 9:25:58 AM11/20/12
to ve...@googlegroups.com
On Nov 20, 2012, at 9:23 AM, Jens Laufer <jensl...@gmail.com> wrote:

But using that is essential to me, because the eventbus is a hot feature.
So how do i solve that problem?

Is it even possible to replace the Apache httpd with vertx-proxy listening to port 80 passing the requests to the tomcat/vert.x applications.
Is this a good idea? Or is there another possibilty?

Apache HTTPD can't handle Websockets.  Nginx has partial support.  I've been looking at using node-http-proxy for this use case.  Someone should write a proxy *in* Vert.x for this very purpose, but it looks like node-http-proxy is going to be the right tool for the job until that happens.

Jens Laufer

unread,
Nov 20, 2012, 9:53:47 AM11/20/12
to ve...@googlegroups.com
Thanks 

Dmitry Sklyut

unread,
Nov 20, 2012, 10:27:38 AM11/20/12
to ve...@googlegroups.com
Remove websockets from a list of sockjs allowed connection types.  Take a look at sockjs docs https://github.com/sockjs/sockjs-client specifically protocols_whitelist.
As long as you exclude websockets - apache mod_proxy works as expected.  

Regards,
Dmitry

bytor99999

unread,
Nov 20, 2012, 11:57:17 AM11/20/12
to ve...@googlegroups.com
But why would you want to exclude websockets?? That is what you would want, and fall back if the browser doesn't support it.

Mark

Tim Fox

unread,
Nov 20, 2012, 12:04:47 PM11/20/12
to ve...@googlegroups.com
Yes, that's what I'd expect SockJS to do: Try websockets and if it fails to connect, fall back.

If that's not happening, and it requires websockets to be explicitly excluded via whitelist then perhaps it's a bug in the SockJS client? Might be worth posting something on the SockJS google group...

Dmitry Sklyut

unread,
Nov 20, 2012, 1:02:07 PM11/20/12
to ve...@googlegroups.com
The only reason to take out websockets is to skip an error in the browser when it fails connection.
Otherwise sockjs does try the next best protocol. 

This is the proxy config that I use and it works just fine.

ProxyPass /eventbus http:/localhost:8888/eventbus retry=5
ProxyPassReverse /eventbus http://localhost:8888/eventbus
Reply all
Reply to author
Forward
0 new messages