0

I have two web apps running in the same virtual machine. One is Beego listening to port 443, and another is Centrifugo messaging server at port 8000.

If a user is not allowed to connect port 8000 due to his ISP, is it possible that I forward https://my.domain/chat_api (intercepted by Beego at port 443) to https://my.domain:8000/chat_api (served by Centrifugo at port 8000), so that my chat client connects port 443 just like connecting port 8000? If yes, how do I implement under Beego's structure?

Ernie
  • 77
  • 3
  • 9
  • If I understand correctly, you have two separate apps written in Go running on the same unix machine? And what you want to do is forward a regular https call (which would be intercepted by Beego app), to the Centrifugo app? – RayfenWindspear Apr 03 '17 at 16:31
  • @RayfenWindspear, yes, exactly! I've added some descriptions to explain more clearly. – Ernie Apr 04 '17 at 04:00

1 Answers1

1

You dont need to implement this in Beego.

Just set up a reverse proxy: (here is an example how to set up a reverse proxy with nginx)

server {
   listen 443;
   server_name example.com;

   location /chat_api {
      proxy_set_header   X-Forwarded-For $remote_addr;
      proxy_set_header   Host $http_host;
      proxy_pass         "http://127.0.0.1:8000";
   }
   location /beego {
      proxy_set_header   X-Forwarded-For $remote_addr;
      proxy_set_header   Host $http_host;
      proxy_pass         "http://127.0.0.1:8080";
   }
}
m13r
  • 26
  • 3