question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Apache 2.4 ProxyPass Configuration

See original GitHub issue

With 0.9 I was able to proxy our websockets through Apache 2.4 using the following config:

ProxyPass /socket.io/1/websocket ws://localhost:8082/socket.io/1/websocket
ProxyPassReverse /socket.io/1/websocket ws://localhost:8082/socket.io/1/websocket

ProxyPass /socket.io/ http://localhost:8082/socket.io/
ProxyPassReverse /socket.io/ http://localhost:8082/socket.io/

I’m attempting to migrate to 1.0.6 now and I immediately noticed that the socket endpoint changed, but updating the ProxyPass config like so does not seem to do the trick.

ProxyPass /socket.io/?EIO=2&transport=websocket ws://localhost:8082/socket.io/?EIO=2&transport=websocket
ProxyPassReverse /socket.io/?EIO=2&transport=websocket ws://localhost:8082/socket.io/?EIO=2&transport=websocket

ProxyPass /socket.io/ http://localhost:8082/socket.io/
ProxyPassReverse /socket.io/ http://localhost:8082/socket.io/

Chrome reports over and over again that it receives a 400 error when trying to open the websocket. There’s no output in the console on the server to indicate that any connection attempt was received (DEBUG=socket.io).

Is there some other configuration factor that I need for this to work?

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:37 (4 by maintainers)

github_iconTop GitHub Comments

14reactions
silasrmcommented, Jul 16, 2016

I’m using this config:

<VirtualHost *:80>
    ServerName ws.domain.com

    RewriteEngine On
    RewriteCond %{QUERY_STRING} transport=polling
    RewriteRule /(.*)$ http://localhost:3000/$1 [P]

    ProxyRequests off
    ProxyPass /socket.io/ ws://localhost:3000/socket.io/
    ProxyPassReverse /socket.io/ ws://localhost:3000/socket.io/

    ErrorLog /.../logs/nodejs_error_log
    CustomLog /.../logs/nodejs_access_log common
    LogLevel warn
</VirtualHost>

Before, install proxy modules:

sudo a2enmod proxy proxy_http proxy_wstunnel

Is ok on Apache/2.4.7

14reactions
lopezdonaquecommented, Jun 23, 2015

Hi,

I have used “Connection” header detection to resolve it.

<VirtualHost x.x.x.x:443>
  ServerName domain.local

  RewriteEngine On
  RewriteCond %{HTTP:Connection} Upgrade [NC]
  RewriteRule /(.*) ws://x.x.x.x:3000/$1 [P,L]

  ProxyPass / http://x.x.x.x:3000/

  SSLEngine on
  SSLCertificateFile /etc/apache2/ssl/STAR_x_com.crt
  SSLCertificateKeyFile /etc/apache2/ssl/STAR_x_com.key
  SSLCertificateChainFile /etc/apache2/ssl/STAR_x_com.ca-bundle

  CustomLog /var/log/apache2/access.x.log combined
  ErrorLog /var/log/apache2/error.x.log

 </VirtualHost>

See issue at: https://github.com/faye/faye/issues/387

Read more comments on GitHub >

github_iconTop Results From Across the Web

mod_proxy - Apache HTTP Server Version 2.4
Apache HTTP Server can be configured in both a forward and reverse proxy (also known as gateway ) mode. An ordinary forward proxy...
Read more >
How to setup an Apache reverse proxy server example
Reverse proxy setup steps · Install the Apache Web Server · Install and configure the backend origin servers · Enable the mod_proxy and...
Read more >
How To Use Apache HTTP Server As Reverse-Proxy Using ...
In this DigitalOcean article, we are going to see set up Apache on Ubuntu 13 and use it as a reverse-proxy to welcome...
Read more >
Apache 2.4 as a Reverse Proxy | By Michael Whittle
For the purpose of this tutorial we will configure the reverse proxy with the IP address 10.0.0.10 on HTTP port 80 and the...
Read more >
Configure a reverse proxy - Apache
Configure Apache to work as a reverse proxy · Open the Apache httpd.conf file in the following directory: · Make sure the following...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found