-
Notifications
You must be signed in to change notification settings - Fork 71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Laravel Reverb in Production Server #107
Comments
What happens if you try https://websockets.amypo.com:8080 in the browser? |
When I visit this URL it gives me "Not Found" error in a blank page 404 |
do you use cyberpanel ? |
No |
It works fine for me on local but I get this error on the server. The server is with DO and Laravel Forge with the switch turned on. I'm using the same settings as amypo-tech OP for Reverb |
Setting Up Subdomain for Reverb ServerTo integrate Reverb with your Laravel application, follow these steps: Create a Subdomain: Begin by creating a subdomain for your Reverb server. This can typically be done through your domain registrar or hosting provider's control panel. Let's say your subdomain is reverb.example.com. Configure Proxy Settings: Set up your web server to proxy requests from your subdomain to the Reverb server's IP and port. Assuming the Reverb server's default IP is 0.0.0.0 and port is 8080, configure the proxy settings to forward requests from reverb.example.com to 0.0.0.0:8080. Configure Laravel Echo: Update your Laravel Echo configuration to use the newly created subdomain reverb.example.com and the default HTTP port 80. This ensures that Laravel Echo can communicate with your Reverb server through the designated subdomain. VITE_REVERB_HOST='reverb.example.com'
VITE_REVERB_PORT=80
VITE_REVERB_SCHEME=http Adjust Reverb Configuration: In your Laravel application's configuration file (typically .env), specify the Reverb host and port. Update the REVERB_HOST to "localhost" and REVERB_PORT to 8080. Your .env file should look like this: Copy code
REVERB_HOST="localhost"
REVERB_PORT=8080 Test Connection: After making these configurations, test the connection by sending an event to Reverb. If everything is set up correctly, your Laravel application should be able to communicate with the Reverb server via the configured subdomain and port. By following these steps, you should have successfully integrated Reverb with your Laravel application using a subdomain-based approach. |
it works great. |
We were able to configure ours to use the same domain name as our app by using the following setup: # NGINX config
...
location /ws/ {
proxy_pass http://127.0.0.1:6050/;
proxy_http_version 1.1;
proxy_set_header Host $http_host;
proxy_set_header Scheme $scheme;
proxy_set_header SERVER_PORT $server_port;
proxy_set_header REMOTE_ADDR $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
} # .env
...
REVERB_SERVER_HOST=127.0.0.1
REVERB_SERVER_PORT=6050
REVERB_APP_ID=1234
REVERB_APP_KEY=key
REVERB_APP_SECRET=secret
REVERB_HOST=127.0.0.1
REVERB_PORT=6050
REVERB_SCHEME=http
VITE_REVERB_APP_KEY="${REVERB_APP_KEY}"
VITE_REVERB_HOST="example.com"
VITE_REVERB_PORT="443"
VITE_REVERB_SCHEME="https"
VITE_REVERB_PATH="/ws"
|
@adrum, I'm pretty sure that configuration will result in a 404 when attempting to broadcast a message from the server as the server routes must all be prefixed with @amypo-tech, can you share your Nginx (or equivalent) configuration? |
<VirtualHost *:80>
|
I have the same type of issue. nothing was helpful. implementing web-sockets in production is like finding water in mars. All the possible ways i have tried.
if some one gives a proper setup or guide from start to end would help for production. in local it took only few minutes to implement. this is the same thing happened before launch of reverb. waiting nearly 6 months to implement in production |
@amypo-tech It's the same issue. You are only serving the reverb/src/Servers/Reverb/Factory.php Lines 97 to 111 in 9e2bd2a
We recommed setting up your server to serve all paths. |
@joedixon that setup I provided is actively working for us. The slash at the end of the proxy_pass directive apparently chops off the /ws from the path before sending it upstream. The server is bypassing NGINX when broadcasting, so it sends it with the correct path. I more or less just wanted to provide another working example. |
Can I view the changes you made to the |
Hello, yesterday I was also struggling a bit to make Reverb work with Forge, but in the end, I figured out a way to make it work. For me, the issue was that I did not have an SSL certificate for the subdomain (Public Hostname) that you set when toggling on Reverb in Forge. I wrote an article about it so maybe it can help someone. You can jump to the end of the article for TLDR so you don't have to read the entire thing. Probably not the best solution, but for now it solved the issue for me. https://tonymasek.com/blog/how-to-make-laravel-reverb-work-on-laravel-forge |
Thanks for your time and for sharing your results. Great. I will give it a try the next time I have to deploy a Reverb server to Laravel Forge. |
No problem, hopefully, it will help you as well 😊 |
This isssue is closed, but I share my solution here https://github.com/laravel/framework/discussions/50675 |
if anyone struggling to make it work on apache cpanel follow this make sub domain with SSL installed on that domain env should be like this
for SSL files and in reverb config file add this
happy coding |
i have same problem and i'm using CyberPanel |
thanks for this man, but why in the world is this not in the docs, ive been struggling to fix the issue for a week. |
@jhalarde thanks for the feedback. The docs do suggest to use |
Can you share your Proxy Configuration? It is not working on my side
|
In case anyone is having issues getting it to work with Caddy
|
Reverb Version
1.0
Laravel Version
11
PHP Version
8.2
Description
I have created a sample laravel 11 project and in which I have configured all the requirements for the laravel reverb.
In local machine/setup reverb is working fine. when I deployed in production server for testing I am getting the bellow error.
![Screenshot 2024-03-20 at 11 15 08 PM](https://private-user-images.githubusercontent.com/74060536/314612917-342258e5-4d43-4e2b-9155-69eb01a7b19d.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQzMTYwOTIsIm5iZiI6MTcyNDMxNTc5MiwicGF0aCI6Ii83NDA2MDUzNi8zMTQ2MTI5MTctMzQyMjU4ZTUtNGQ0My00ZTJiLTkxNTUtNjllYjAxYTdiMTlkLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MjIlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODIyVDA4MzYzMlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWI5NzJhZWM4ZmU3Y2M5YWY2ODkzN2Y5NDg3YzM0MWUxNzRlM2I1ZGM0ZmIwNWYyYmZjZmFiMGY2NzEwOWE2ZGUmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.k6X9Pp4y01zUU_NBvTs4jAszWjZeIw0wmA7mjl_nBB4)
Steps To Reproduce
None of the above helped me. Kindly help me on this.
.env
config/reverb.php
The text was updated successfully, but these errors were encountered: