3

I need to configure in Apache 2.4.9 (with mod_proxy and mod_proxy_wstunnel activated) a proxy with this mapping:

E.g.:

In other words, I need a proxy that keeps (preserves) the protocol.

This configuration does not work:

<VirtualHost *:80>
   ...
   ProxyRequests Off
   ProxyPreserveHost Off
   ProxyPass / http://my.backend:8080/
   ProxyPassReverse / http://my.backend:8080/
</VirtualHost>

because all request (no matter protocol) are proxied to http*

Anyone knows how can I solve this?

Thanks!

Juan Ignacio Barisich
  • 2,061
  • 19
  • 21
  • This is related - http://stackoverflow.com/questions/18784658/using-go-websocket-behind-apache-mod-proxy-wstunnel –  Sep 02 '14 at 08:44

1 Answers1

0

A posible solution is:

RewriteEngine On
RewriteCond %{HTTP:Upgrade} =WebSocket [NC,NV]
RewriteRule ^/(.*) ws://my.backend:8080/$1 [P]
RewriteRule ^/(.*) http://my.backend:8080/$1 [P]

Source: http://mail-archives.apache.org/mod_mbox/httpd-dev/201405.mbox/%3C6FF4EBA7-866D-4D76-A10D-3D04B896EE87@jaguNET.com%3E

Juan Ignacio Barisich
  • 2,061
  • 19
  • 21
  • 1
    Hi - can you please edit the essential parts of that into your answer so that it stands alone? Thanks! – Rup Oct 08 '14 at 16:29