I want to use Apache to reverse proxy my websocket server.
The socket web server works properly without Apache and has no problems. But when using Apache as websocket reverse proxy , no message delivers to user even tough the Web socket handshake is done properly.
When the connection is closed, all messages are suddenly transmitted to the user.
as you can see handshake with socket server is done properly but no welcome message is send to the client(when using apache reverse proxy)
closing socket server (like ctrl+c) will cause all the stuck data arrive at once
In my experiment, if a large amount of text is echoed at the beginning of the connection(in socket server as welcome message), after passing a certain volume (maybe for($i<200) times echoing welcome message instead of one time), all the text is transferred to the user. Apache seems to be buffering the body of the web socket and flashing it after the buffer is full
my apache directive for reverse proxy :
RewriteCond %{HTTP:Upgrade} websocket [NC]
RewriteCond %{HTTP:Connection} upgrade [NC]
RewriteRule ^/?(.*) ws://127.0.0.1:6001/$1 [P,L]
Web socket server : laravel websocket
Php version : 8
Os : centos 7 - managed by whm
update : installed nginx and tried the same everything and it works. I think there is a very high probability that this problem is from Apache or its modules.
any idea of what is going on ?