How to restrict access via IP when install Discourse by Docker


(Steve Diện) #1

I installed Discourse by Docker on Digital OCean VPS
But now I can access my website via IP and domain. Especially, when I access by IP, it not redirect to domain, then IP is domain. I want restrict access to my website by IP or forward to main domain when access by IP. How to do this?
Thanks!


(Wes Osborn) #2

I don’t believe that it is possible to prevent access to a web service by its IP address. Yes, accessing by IP address might prevent resources from loading, but when you enter a DNS name, its simply translating the domain name into an IP address anyhow: How Domain Name Servers Work | HowStuffWorks

Maybe you can give us some examples of what is happening so we can offer you some possible alternatives.


(Sam Saffron) #3

Not really, you send a hostname in the headers…

What you do in NGINX is set it to redirect anything that does not specify the correct hostname.