0
votes

I'm struggling with the Apache rewrite engine mecanism, specially with a websocket rewrite.

I have this configuration in my httpd.conf :

    LoadModule proxy_wstunnel_module modules/mod_proxy_wstunnel.so
    [...]
    <IfModule mod_rewrite.c>
            LogLevel rewrite:trace8
            RewriteEngine On
            RewriteCond %{HTTP:UPGRADE} ^(.*)WebSocket(.*)$ [NC]
            RewriteCond %{HTTP:CONNECTION} ^(.*)Upgrade(.*)$ [NC]
            RewriteRule .* ws://host_to_redirect%{REQUEST_URI} [P]
    </IfModule>

But this configuration does not seem to work, I don't see logs URL calls in my host_to_redirect. However, I see this rewrite logs in Apache :

[Fri Aug 31 10:21:35.170174 2018] [rewrite:trace1] [pid 27194] mod_rewrite.c(468): [client 160.35.1.22:54354] 160.35.1.22 - - [host_apache_httpd/sid#7f150fe11a70][rid#7f15105ea430/initial] go-ahead with proxy request proxy:https://host_apache_httpd/ws://host_to_redirect/websocket/ack/297/051schka/websocket [OK]

Apache is litteraly concatenating the Apache host and the destination host. Like Apache did not understand the websocket protocol. But the wstunnel module is fully activated...

Do you have any ideas ? :) Thanks !

Specs :

  • Centos6
  • Apache 2.4.6
1

1 Answers

0
votes

Finally, I found the answer !

It was a known issue on Apache : https://bz.apache.org/bugzilla/show_bug.cgi?id=55598

You have to upgrade your Apache HTTPD to get it works !