Vaadin Push Transport LONG_POLL - Invalid JSON

When I choose LONG_POLL as transport for push I get

Unable to parse JSON: {"syncId":22275,"clientId":0,"meta":{"async":true},"timings":[7519,0] }]for(;;);[{"syncId":22276,"clientId":0,"meta":{"async":true},"timings":[7519,0] }

When I remove LONG_POLL I get

[qtp1959910454-62] WARN com.vaadin.flow.server.communication.PushHandler - Invalid identifier in new connection received from 0:0:0:0:0:0:0:1

I’m lost here.

The issue was in my setup. I had an apache server forwarding to the tomcat instance. The rewrite rule didn’t work. Its solved now by using

RewriteCond %{HTTP:Upgrade} !=websocket
RewriteRule ^/(.*) http://tomcatserver:8080/$1 [P]


RewriteCond %{HTTP:Upgrade} =websocket
RewriteRule ^/(.*) ws://tomcatserver:8080/$1 [P]