TransWikia.com

Correct way to proxy pass / port forwading apps between 3 linux server with NginX

Unix & Linux Asked by Yeremia Danang on August 28, 2020

I’m building RTC video call with janus gateway through websockets.
Need some suggestion about how to proxy pass 3 server.
I don’t know if port forwarding is the correct name for this case

I have 3 server: A -> B -> C
Janus gateway installed on server C on port 8080
then I configure Nginx on server B to proxy pass that C:8080
like this

location /janus {
        proxy_pass http://C:8080;
    }

then on server A the configure should be like this:

location /janus {
            proxy_pass http://B/janus;
        }

Then I can access C:8080 with this url: http://A/janus
It works.
Can I use same approach to run websocket through proxy pass?
the configure should be like this on server B:

map $http_upgrade $connection_upgrade{
    default upgrade;
    '' close;
}

upstream Cwebsocket{
    server C:8188;
}
server {
    listen 443 ssl default_server;
    listen [::]:443 ssl default_server;

    location /Bwebsocket{
        proxy_pass https://Cwebsocket;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection $connection_upgrade;
    }
}

Then I configure this on server A:

server {
    listen 443 ssl default_server;
    listen [::]:443 ssl default_server;

    location /Awebsocket{
        proxy_pass http://B/Bwebsocket;
    }
}

Is it the correct way to proxy_pass between servers specially for websocket?
Or I have to use different approach with this case? CMIIW

Actually its not efficient to use 3 server but this topology kinda policy on my place.
Need help guys

Thanks in advance 🙂

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP