Block Direct Connections


(Bálint Antal) #1

How can I block direct connections to Discourse and force people to use my domain instead of the ip:port version?

It is important because my server would work like this:

Varnish -> Nginx -> Discourse.


(Sam Saffron) #2

use a private ip for nginx and discourse.


(Bálint Antal) #3

Yeah, I see and I’ve set Nginx to listen to 127.0.0.1:8080, but how can I set Discourse to use only 127.0.0.1:8020?


(Sam Saffron) #4

Your container is in a sandbox, you choose what to export out of it.


(Bálint Antal) #5

I see! People wrote everywhere that I want to use iptables, but there was no formula which would work for me.

The solution is to write the ip (127.0.0.1) before the port:

expose:
  - "127.0.0.1:8020:80"

Thanks for your help!