Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

givko's avatar
Level 1

How to set up Reverb in a production with Apache server

I am working on a website which is an online game using Laravel 11 with View 3 and Reverb (SPA without SSR for now). On the localhost the websockets work, but when I uploaded it to the production server with Apache they don't work. On localhost in .env I have

REVERB_HOST="localhost"
REVERB_PORT=8080
REVERB_SCHEME=http

In production I change them to

REVERB_HOST="www.mydomain.com"
REVERB_PORT=443
REVERB_SCHEME=https

Also in the virtual host file I add the

<VirtualHost 192.168.100.12:443>
...
 SSLEngine On
 ProxyPass "/app" "ws://0.0.0.0:8080/app"
 ProxyPassReverse "/app" "ws://0.0.0.0:8080/app"
</VirtualHost>

After these settings in the browser tab for Network / websockets I now get that there is a connection established

{"event":"pusher:connection_established","data":"{\"socket_id\":\"325487270.879942365\",\"activity_timeout\":30}"}
{"event":"pusher:subscribe","data":{"auth":"yzvrte6lfsudidxcfwkg:4055a502db436191e71198aeadf394db1defd0850c86e55f37fde6d59a9e83eb","channel":"private-user.3"}}
{"event":"pusher_internal:subscription_succeeded","data":"{}","channel":"private-user.3"}

As well as pinging periodically. But when the server tries to send data through the websocket I get the error

The POST method is not supported for route apps/174502/events. Supported methods: GET, HEAD.

This route is located in

/vendor/laravel/reverb/src/Servers/Reverb/Factory.php

    protected static function pusherRoutes(): RouteCollection
    {
        $routes = new RouteCollection;
...
        $routes->add('events', Route::post('/apps/{appId}/events', new EventsController));
        return $routes;
    }

Why is it giving me this error? I might be doing something wrong in the configuration. Does anyone have any idea how to properly configure Reverb for Apache?

0 likes
2 replies
Erutan409's avatar

For others looking for the solution (Windows):

You'll need to configure your v-hosts file to look something like this:

<VirtualHost *:443>

    ServerName ws.your.domain.com
    SSLEngine on
    SSLProxyEngine on
    # Make sure your cert information is configured

    ProxyPass /app ws://localhost:8080/app upgrade=websocket
    ProxyPassReverse /app ws://localhost:8080/app
    ProxyPass /apps ws://localhost:8080/apps
    ProxyPassReverse /apps ws://localhost:8080/apps

</VirtualHost>

For the required modules (httpd.conf):

LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_http2_module modules/mod_proxy_http2.so
LoadModule proxy_wstunnel_module modules/mod_proxy_wstunnel.so
LoadModule ssl_module modules/mod_ssl.so

Granted, some of these may not be necessary for your configuration, but I was getting unsupported protocol in the error logs until I enabled wstunnel.

In your .env file, you'll have to ensure that your reverb server is configured to run like this:

REVERB_APP_ID=your_id
REVERB_APP_KEY=your_key
REVERB_APP_SECRET=your_secret
REVERB_HOST="127.0.0.1"
REVERB_PORT=8080
REVERB_SCHEME=http

VITE_REVERB_APP_KEY="${REVERB_APP_KEY}"
VITE_REVERB_HOST=ws.your.domain.com
VITE_REVERB_SCHEME=https
VITE_BASE_URL=https://your.domain.com

Notice that the settings passed to the reverb instance and the front-end code will need to be different to accommodate the proxying.

Please or to participate in this conversation.