Laravel Reverb on Hetzner Managed server
I recently switched my hosting setup to a Hetzner Managed server, because I was tired of managing my own servers.
And the great thing with a Hetzner Managed server is that I have all the things needed for running a Laravel app like: Redis, supervisord and so on.
The only tricky thing was getting Reverb running with one of my projects. After some back and forth with their support and some own research, I came up with a working solution.
To get there you have to create a subdomain (eg ws.domain.com) and point it to an empty directory on the server.
There you put .htaccess file with the following content in it:
RewriteEngine on
RewriteCond %{HTTP:Connection} upgrade$ [NC]
RewriteCond %{HTTP:Upgrade} =websocket [NC]
RewriteRule "^app(.*)$" "ws://localhost:8080/app$1" [P,L]
RewriteCond %{REQUEST_URI} ^/app [NC]
RewriteRule "^app(.*)$" "http://localhost:8080/app$1" [P,L]
For that to work, Hetzner's support team has to activate the proxy_wstunnel module on your server.
After that is done, Reverb works fine.
Thanks to Hetzner for their amazing support!