Skip to content
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

reverb wont work with ssl on ubuntu #176

Closed
ahmedalkhairy opened this issue Apr 27, 2024 · 6 comments
Closed

reverb wont work with ssl on ubuntu #176

ahmedalkhairy opened this issue Apr 27, 2024 · 6 comments
Assignees

Comments

@ahmedalkhairy
Copy link

Reverb Version

1.0.0-(beta9)

Laravel Version

11.5

PHP Version

8.2.16

Description

i have a problem since announcing laravel reverb
i run laravel app on ubuntu 22 server ,
apache2
php 8.2

reverb works good with no ssl , but when i activate ssl , it refuse to handshake

reverb config:

'servers' => [

    'reverb' => [
        'host' => env('REVERB_SERVER_HOST', '0.0.0.0'),
        'port' => env('REVERB_SERVER_PORT', 8080),
        'hostname' => env('REVERB_HOST'),
        'options' => [
            'tls' => [
    'local_cert' => env('REVERB_SSL_LOCAL_CERT'),
    'verify_peer' => false,
],
            ],
        'scaling' => [
            'enabled' => env('REVERB_SCALING_ENABLED', false),
            'channel' => env('REVERB_SCALING_CHANNEL', 'reverb'),
        ],
        'pulse_ingest_interval' => env('REVERB_PULSE_INGEST_INTERVAL', 15),
    ],

],

.env

REVERB_SERVER_HOST=0.0.0.0
REVERB_SERVER_PORT=8080
REVERB_HOST="cp.*****.com"
REVERB_PORT=443

getting error in apache logs
AH00961: https: failed to enable ssl support for 127.0.0.1:8080 (localhost)

i have tried to remove ssl options , and redirect from .htaccess , always the samp

Steps To Reproduce

install laravel 11 app
setup reverb config as docs
activate ssl

@fasihll
Copy link

fasihll commented Apr 29, 2024

i have same problem

@joedixon
Copy link
Collaborator

What does your Apache configuration look like?

@ahmedalkhairy
Copy link
Author

ahmedalkhairy commented Apr 29, 2024

<VirtualHost *:80>
ServerName reverb.xxxxxx.com

ProxyPass / http://0.0.0.0:8080/
ProxyPassReverse / http://0.0.0.0:8080/

ProxyPreserveHost On

RewriteEngine on
RewriteCond %{SERVER_NAME} =reverb.xxxxx.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]

i have also tried with another server running nginx

server {
server_name reverb.sellenvo.com;
root /var/www/reverb/public;

add_header X-Frame-Options "SAMEORIGIN";
add_header X-XSS-Protection "1; mode=block";
add_header X-Content-Type-Options "nosniff";

index index.html index.htm index.php;

charset utf-8;

    location / {

try_files $uri $uri/ /index.php?$query_string;

}

location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt  { access_log off; log_not_found off; }

error_page 404 /index.php;

location ~ \.php$ {
    fastcgi_pass unix:/var/run/php/php8.2-fpm.sock;
    fastcgi_index index.php;
    fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
    include fastcgi_params;
}

location /app/ {

proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
proxy_pass http://0.0.0.0:8080;

proxy_read_timeout 300s;
proxy_connect_timeout 75s;

access_log /var/log/nginx/app_access.log;

proxy_redirect off;
}

location ~ /\.(?!well-known).* {
    deny all;
}

listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/reverb.xxxx.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/reverb.xxxxxx.com/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot

}
server {
if ($host = reverb.sellenvo.com) {
return 301 https://$host$request_uri;
} # managed by Certbot

listen 80;
server_name reverb.xxxxxx.com;
return 404; # managed by Certbot

}

@joedixon
Copy link
Collaborator

It's been a while since I have worked with Apache, but is part of the issue that you only have a VirtualHost running on port 80?

With Nginx, you can't use location /app/ as not every route into the Reverb server is prefixed with app.

@purnada
Copy link

purnada commented May 2, 2024

I have same problem.
This code is work in localhost but when i push this code to the production server it will not work.. reverb connection is success but when i want to broadcast the event it throw the error

This is the connection status

image

my .env

BROADCAST_CONNECTION=reverb
VITE_APP_NAME="${APP_NAME}"

REVERB_SERVER_HOST=127.0.0.1
REVERB_SERVER_PORT=8080

REVERB_APP_ID=920552
REVERB_APP_KEY=mop6z2fyoey59fm7l3ro
REVERB_APP_SECRET=eehaek3gn748kcyfcqxq
REVERB_HOST="reverb.xxxx.com"
REVERB_PORT=443
REVERB_SCHEME=https

VITE_REVERB_APP_KEY="${REVERB_APP_KEY}"
VITE_REVERB_HOST="${REVERB_HOST}"
VITE_REVERB_PORT="${REVERB_PORT}"
VITE_REVERB_SCHEME="${REVERB_SCHEME}"

my broadcast config is

connections' => [

        'reverb' => [
            'driver' => 'reverb',
            'key' => env('REVERB_APP_KEY'),
            'secret' => env('REVERB_APP_SECRET'),
            'app_id' => env('REVERB_APP_ID'),
            'options' => [
                'host' => env('REVERB_HOST'),
                'port' => env('REVERB_PORT', 443),
                'scheme' => env('REVERB_SCHEME', 'https'),
                'useTLS' => env('REVERB_SCHEME', 'https') === 'https',
            ],
            'client_options' => [
                // Guzzle client options: https://docs.guzzlephp.org/en/stable/request-options.html
            ],
        ],

        'pusher' => [
            'driver' => 'pusher',
            'key' => env('PUSHER_APP_KEY'),
            'secret' => env('PUSHER_APP_SECRET'),
            'app_id' => env('PUSHER_APP_ID'),
            'options' => [
                'cluster' => env('PUSHER_APP_CLUSTER'),
                'host' => env('PUSHER_HOST') ?: 'api-'.env('PUSHER_APP_CLUSTER', 'mt1').'.pusher.com',
                'port' => env('PUSHER_PORT', 443),
                'scheme' => env('PUSHER_SCHEME', 'https'),
                'encrypted' => true,
                'useTLS' => env('PUSHER_SCHEME', 'https') === 'https',
            ],
            'client_options' => [
                // Guzzle client options: https://docs.guzzlephp.org/en/stable/request-options.html
            ],
        ],
]

my event file is

namespace App\Events;


use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Broadcasting\PrivateChannel;
use Illuminate\Contracts\Broadcasting\ShouldBroadcastNow;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Queue\SerializesModels;

class MessageTypingEvent implements ShouldBroadcastNow
{
    use Dispatchable, InteractsWithSockets, SerializesModels;

    public $from;

    public $to;

    public $type;

    /**
     * Create a new event instance.
     */
    public function __construct($from,$to,$type)
    {
        $this->from = $from;
        $this->to = $to;
        $this->type = $type;

    }

    /**
     * Get the channels the event should broadcast on.
     *
     * @return array<int, \Illuminate\Broadcasting\Channel>
     */
    public function broadcastOn(): array
    {
        return [
            new PrivateChannel('message_typing'.$this->to),
        ];
    }
}

when i call this function

public function removeReading($id)
    {
        
        MessageTypingEvent::dispatch(auth()->user()->id, $id,'stop');
    }

my route is

Broadcast::channel('message_typing{id}', function($user,$id){
    return (int) $user->id === (int) $id;
});

it through the error is

. {"userId":4,"exception":"[object] (Illuminate\Broadcasting\BroadcastException(code: 0): Pusher error:
at /var/www/xxxx/vendor/laravel/framework/src/Illuminate/Broadcasting/Broadcasters/PusherBroadcaster.php:164)

@joedixon
Copy link
Collaborator

joedixon commented May 2, 2024

If you start the server with debug mode enabled (php artisan reverb:start --debug), you might be able to see the cause.

I don't think this is related to the original issue though, so please open a new one if you are unable to track it down. Closing this issue for now due to lack of activity.

@joedixon joedixon closed this as completed May 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants