You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Heinz Romirer <h....@gmail.com> on 2013/10/23 16:34:58 UTC

[users@httpd] WebSocket Proxying only working on local machine, fails on other machines in the network

Hello fellow Apache Users ;)

I'm new to this mailing list and I hope to be able to contribute to this
list as much as I hope to gain knowledge from it :)

I'm stuck while configuring my web server (unfortunately I'm bound to a
Windows machine and I must not switch to *nix because of company policy).
The web server consists of the following components:

# Tomcat 7.0.42
# Apache 2.4.6
# Windows 7 Ultimate 64bit

I have to use WebSockets as the web application depends heavily on this new
technology and it is also not only a "nice to have" but nearly a "must" to
get the application up and running. The web application itself consists of
TWO applications - an authentication "server" and the application itself.
Both of them are independent WARs at Tomcat and proxied by the Apache
httpd. I use the Atmosphere Framework to implement WebSockets in the
backend, and the jquery.atmosphere.js JavaScript library to implement
WebSockets in the frontend.

Here's my configuration:

############################# httpd-vhosts.con ############################
<VirtualHost _default_:80>
  ServerName localhost

  RewriteEngine on
  RedirectMatch ^/$ /bloggofant/
  RewriteRule ^/bloggofant$ /bloggofant/ [R]
  RewriteRule ^/bloggofant/authenticated$ /bloggofant/authenticated/ [R]

  ProxyRequests Off
  ProxyPreserveHost On
  ProxyVia On
  <Proxy *>
   AddDefaultCharset off
   Order deny,allow
   Allow from all
  </Proxy>

  #ProxyHTMLLogVerbose On
  LogLevel debug

  ProxyHTMLEnable On
  ProxyHTMLBufSize  102400
  ProxyHTMLExtended On
  ProxyHTMLStripComments Off
  ProxyHTMLDocType "<!DOCTYPE html>" XML
  ProxyHTMLMeta On

  DocumentRoot "${SRVROOT}/htdocs/"

  ProxyPass /bloggofant/authenticated/websock
ws://localhost:8080/BloggoFantApp/websock
  <Location /bloggofant/authenticated/websock>
    ProxyPassReverse ws://localhost:8080/BloggoFantApp/websock
    ProxyHTMLURLMap /BloggoFantApp/websock /bloggofant/authenticated/websock
  </Location>

  ProxyPass /bloggofant/authenticated/ ajp://localhost:8009/BloggoFantApp/
  ProxyHTMLURLMap ajp://localhost:8009/BloggoFantApp
/bloggofant/authenticated/
  <Location /bloggofant/authenticated/>
   ProxyPassReverse ajp://localhost:8009/BloggoFantApp/
   SetOutputFilter proxy-html
   ProxyHTMLURLMap /BloggoFantApp/ /bloggofant/authenticated/
   ProxyPassReverseCookiePath /BloggoFantApp/ /bloggofant/authenticated/
   #RequestHeader unset Accept-Encoding
  </Location>

  ProxyPass /bloggofant/ ajp://localhost:8009/BloggoFantAuthentication/
  ProxyHTMLURLMap ajp://localhost:8009/BloggoFantAuthentication /bloggofant/
  <Location /bloggofant/>
   ProxyPassReverse ajp://localhost:8009/BloggoFantAuthentication/
   SetOutputFilter proxy-html
   ProxyHTMLURLMap /BloggoFantAuthentication/ /bloggofant/
   ProxyPassReverseCookiePath /BloggoFantAuthentication/ /bloggofant/
   #RequestHeader unset Accept-Encoding
  </Location>

</VirtualHost>
###########################################################################


If I access the web application from the machine where my web server is
running, all is fine and the websocket connect is established as awaited,
_but_ if I try to access the application from another machine in the
network, the websocket connection is not working anymore and I can't see
why? It seems like the "ProxyPassReverse" within the websock location is
not working correctly as I see the frontend JavaScript trying to open the
websocket connection and also the backend logging the attempt, but it seems
that the response is never sent!?

Does anybody have a hint or could give me some advice on this topic? Even
if it's only a 'best guess' - every response is highly appreciated! If you
need more information, please don't hesitate to ask! ;)

cheers
heinz