Take the 2-minute tour ×

I've been working on a Perl Mojolicious project that uses websockets. I'm wanting to launch it on a shared server running apache and use proxyPass and proxyPassReverse to make the url prettier for my Mojolicious code running with Hypnotoad.

I have it set up as follows.

Apache url:


Hypnotoad url:


With the following apache entry I can reverse proxy the Hypnotoad server to


apache.conf entry

<VirtualHost *:80>
  ServerName project.mydomain.com
  DocumentRoot /var/www/project
  <Directory /var/www/project/>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride None
    Order allow,deny
    allow from all
  ProxyRequests Off
  ProxyPreserveHost On
  ProxyPass / http://mydomain.com:8080/ keepalive=On
  ProxyPassReverse / http://mydomain.com:8080/
  RequestHeader set X-Forwarded-HTTPS "0"

However my websocket requests give a 404 error when I use:


and a 302 error when I use:


I guess this wouldn't be a problem is the websocket didn't check for authentication, but they use Mojolicious routes to check that you can post via the websocket.

From what I can see Apache doesn't support reverse proxying websockets. In apache/httpd conf files.

Has anyone found a usable solution to this using Apache that is stable for a production environment?

share|improve this question

3 Answers 3

In March a patch was committed to the Apache trunk by Jim Jagielski which allows websockets to be proxied correctly. The patch adds a new submodule called proxy_wstunnel which allows mod_proxy to work with the "ws" and "wss" protocols.

The module is not yet in any official Apache releases (as of June 8th 2013), so you will need to compile it yourself. Voyageur's blog describes the process for Apache 2.2, but it should be easier for Apache 2.4

share|improve this answer
@user1439590 you should accept this as the answer –  lkraav Dec 30 '13 at 2:22

Apache httpd 2.4.6 includes proxying websocket requests.

share|improve this answer
This would be more suited to a comment rather than an answer. Once you have enough reputation, please consider moving this to a comment on the question. –  Sameer Singh Aug 8 '13 at 14:30
@SameerSingh I think this is exactly the answer to the question, by the committer of the patch. –  iwein Oct 20 at 13:35

This might be what you are looking for. Take a look at: https://npmjs.org/package/npr

share|improve this answer

Your Answer


