Search code examples
apacheproxyapache2mod-proxy

Proxy port without changing URL in apache


is there a way to proxy URL to another port in apache? For example I would like to (reverse) proxy URL:

http://*.localhost/engine.io/?EIO=2&transport=polling

from port 80 to port 8080 without changing url:

http://*.localhost:8080/engine.io/?EIO=2&transport=polling

Thank you!


Solution

  • In your *.localhost (port 80) vhost, add:

    RewriteEngine On
    RewriteCond %{SERVER_PORT} 80
    RewriteCond %{HTTP_HOST} ^(.*)$
    RewriteRule ^/engine\.io/$ http://%1:8080/engine.io/?%{QUERY_STRING} [L,P]