Dimitris Konomis
Dimitris Konomis

Reputation: 326

Nginx proxy webrtc kurento media server configuration

I'm trying to configure o proxy for my website that is using webrtc kurento media server. Everything works except that i can't connect to media server when using nginx proxy.

Here my nginx configuration

   server {
    listen       80;
    server_name  xxx.xxx.xxx.xxx;
    rewrite ^ https://$http_host$request_uri? permanent;    # force redirect http to https
}
server {
    listen 443;
    ssl on;
    ssl_certificate           crt.crt;
    ssl_certificate_key       key.key;
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    server_name xxx.xxx.xxx.xxx;
    proxy_set_header X-Forwarded-For $remote_addr;

    add_header Strict-Transport-Security "max-age=31536000; includeSubdomains";
    server_tokens off;

     location /one2one {
        proxy_pass https://127.0.0.1/one2one;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
    }

    location / {
        proxy_pass    https://127.0.0.1:9000/;
    }

}

and the error i get is the following

WebSocket connection to 'wss://xxx.xxx.xxx.xxx/one2one' failed: Error during WebSocket handshake: Unexpected response code: 500

Upvotes: 3

Views: 3129

Answers (1)

Yup Adm
Yup Adm

Reputation: 11

I suppose this issue is already solved by the author of the post, but for others who has the same problem I want to share my nginx proxy configuration for kurento media server. Server listens on port 443.

    location /kurento {
            # prevents 502 bad gateway error
            proxy_buffers 8 32k;
            proxy_buffer_size 64k;
            # redirect all HTTP traffic to localhost:8088;
            proxy_pass http://127.0.0.1:8888/kurento;

            # enables WS support
            proxy_http_version 1.1;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection "upgrade";
            proxy_read_timeout 999999999;
        }

Access socket via wss://xxx.xxx.xxx.xxx/kurento.

Upvotes: 1

Related Questions