AnswerBun.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!

Related Questions

init script for alpine not working

1  Asked on January 18, 2021 by karlsebal

   

Filter rows of a file by list of a second file

1  Asked on January 18, 2021 by sh-yang

       

Have to restart network service after reboot (centos 7)

1  Asked on January 17, 2021 by raoulpetite

   

query regarding puppet stdlib module

0  Asked on January 16, 2021 by rajnish-kumar-soni

 

Bash – Running a bash script from within a ksh script

1  Asked on January 16, 2021 by mo12

     

Pop OS doesn’t boot up because of pci-e bus error

1  Asked on January 16, 2021 by user6516763

     

How do I reformat a hybrid-mbr sd card?

0  Asked on January 12, 2021 by dave-mankoff

 

bash Noob: What’s wrong with this line?

1  Asked on January 12, 2021 by ottoeisen

   

How can I save the last command to a file?

4  Asked on January 12, 2021 by mattlbeck

     

Sourcing /root/.zshrc in Docker using current user

3  Asked on January 9, 2021 by mihai-galos

 

Ask a Question

Get help from others!

© 2022 AnswerBun.com. All rights reserved. Sites we Love: PCI Database, MenuIva, UKBizDB, Menu Kuliner, Sharing RPP, SolveDir