Block Direct Connections

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.

use a private ip for nginx and discourse.

1 Like

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?

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

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!

2 Likes