Push issue when using Tomcat behind Apache

Hello,

I’m working on a project where we’ve implemented “push” behavior, which doesn’t “behave” the way we expect it to when Apache is the way.
Using Vaadin 7.5, Tomcat 8.0.23, Apache 2.2.15, Chrome 45.0.2454.101 m, Firefox 41.0.1.
We do get the UI behaving fine when the URL directly aims at Tomcat’s http port, so we know that push mechanism works. But when the URL goes through Apache, it hangs.
The error, (provided by Chrome webdev toolkit) :

vaadinPush.js?v=7.5.0:25 Vaadin push loaded / “WebSocket connection to 'ws://10.198.133.116:8080/gaap/PUSH?v-uiId=1&v-csrfToken=ccd23926-8d36-448f-941c-13b12cd7fe89&X-Atmosphere-tracking-id=0&X-Atmosphere-Framework=2.2.6.vaadin4-jquery&X-Atmosphere-Transport=websocket&X-Atmosphere-TrackMessageSize=true&Content-Type=application/json;%20charset=UTF-8&X-atmo-protocol=true' failed: Error during WebSocket handshake: Unexpected response code: 500 What I tried:
(from
http://stackoverflow.com/questions/18918392/how-to-get-vaadin-push-work-through-apache-http-server
)

[code]
Add this in httpd.conf
RewriteEngine on
RewriteCond %{QUERY_STRING} ^((?!X-Atmosphere-Transport=websocket).)*$
RewriteRule ^/PUSH/ http://serverIpAdress:8080/gaap/PUSH/$1 [P]

ProxyPass /gaap/PUSH/ ws:// serverIpAdress:8080/gaap/PUSH/
ProxyPassReverse /gaap/PUSH/ ws:// serverIpAdress:8080/gaap/PUSH/
ProxyPass /gaap/VAADIN/ ws:// serverIpAdress:8080/gaap/VAADIN/
ProxyPassReverse /gaap/VAADIN/ ws:// serverIpAdress:8080/gaap/VAADIN

ProxyPass / ajp://localhost:9700/
[/code]In Tomcat’s server.xml :

[code]

<Executor name="OrangeAjpThreadPool"
          namePrefix="orange-ajp-exec-"
          maxThreads="256"         
          minSpareThreads="25"              
          prestartminSpareThreads="true"              
          maxIdleTime="60000"/>    

<Connector port="9700"               
           protocol="org.apache.coyote.ajp.AjpNioProtocol"
           acceptCount="256"               
           connectionTimeout="5000"               
           keepAliveTimeout="60000"               
           maxConnections="10000"               
           enableLookups="false"
           executor="OrangeAjpThreadPool"               
           acceptorThreadCount="1"

/>
[/code]In this post,
Vaadin 7.1 - push implementation lacking
, I read that push with Vaadin wasn’t that sharp, but I’m sure this is obsolete news now ?
The issue only pops out when Apache’s dealing with push ; but there again, I guess it’s just me ignoring how to tune it, though I’ve been crawling the Web for a while.
So, any enlightenment

two things:

  • the PUSH path changed recently i think, omit the trailing “/” (see Release Notes - Incompatible or Behavior-altering Changes in 7.5 )
  • httpd 2.2 does not support websockets AFAIK, you need to update to version 2.4.

Thanks a lot Bernd for your support. We won’t be able to upgrade to http 2.4, this choice is not ours (client production environment), but it’s good to know that it actually can work, so, I’ll give it a try for my own curiosity, if I get a chance. We’ve overcome the issue by …… not using the PUSH annotation (and mecanism, so), that we needed to refresh style when navigating in the UI. All that deals with style, set in widgetset in the first place, has been moved to the UI part.

Regards,

Hi friends, I am working on the same problem.

By using the same configuration, I have get the vaadin app working, via the HTTP ==> Apache HTTP Server ==> Tomcat

But when I access the vaadin app via HTTPS, Apache HTTP Server will give me a 404 not found error.

I can access the other static html pages via HTTPS, So I believe that HTTPS configuration of Apache is OK.

So I think maybe I need to change the port number of [VirtualHost]
:

From:

<VirtualHost *:80>
    RewriteEngine on
    RewriteCond %{QUERY_STRING} ^((?!X-Atmosphere-Transport=websocket).)*$
    RewriteRule ^/PUSH/ http://localhost:8080/app/PUSH/$1 [P]

    
    ProxyPass          /app/PUSH     ws://localhost:8080/app/PUSH
    ProxyPassReverse   /app/PUSH     ws://localhost:8080/app/PUSH
    ProxyPass          /app/VAADIN   ws://localhost:8080/app/VAADIN
    ProxyPassReverse   /app/VAADIN   ws://localhost:8080/app/VAADIN
    ProxyPass          /app          ajp://localhost:8009/app
</VirtualHost>

To:

<VirtualHost _default_:443>
    RewriteEngine on
    RewriteCond %{QUERY_STRING} ^((?!X-Atmosphere-Transport=websocket).)*$
    RewriteRule ^/PUSH/ http://localhost:8080/app/PUSH/$1 [P]

    
    ProxyPass          /app/PUSH     ws://localhost:8080/app/PUSH
    ProxyPassReverse   /app/PUSH     ws://localhost:8080/app/PUSH
    ProxyPass          /app/VAADIN   ws://localhost:8080/app/VAADIN
    ProxyPassReverse   /app/VAADIN   ws://localhost:8080/app/VAADIN
    ProxyPass          /app          ajp://localhost:8009/app
</VirtualHost>

But when I did this, I get a error in the error.log file, when I try to start Apache:

You configured HTTP(80) on the standard HTTPS(443) port! And the browser says it can not establish a SSL connection.

What am I doing is wrong?

Any help will be appreciated!

Hi friends, I have solved my problem.

It my bad.

It is something about the order of conf files.
(1)I am using Ubuntu 14, It includes mods-enabled/.conf BEFORE sites-enabled/.conf
(2)I putted ProxyPass/ProxyPassReverse setting in some conf file under mods-enabled
and putted SSL setting in some file under sites-enabled

So ProxyPass/ProxyPassReverse setting is applied BEFORE SSL setting.
And this caused SSL start failing.

I moved ProxyPass/ProxyPassReverse setting to the same conf file of SSL setting,
and now HTTPS ==> Apache HTTP Server ==> Tomcat is working fine.