0

I'm starting to learn C # and try to develop an app which run on Ubuntu using Kestrel.

Now netstat command show next:

Proto Recv-Q Send-Q Local Address Foreign Address State

tcp 0 0 0.0.0.0:5000 0.0.0.0:* LISTEN

As far as I understand the server accepts requests from any foreign address, but I want it from only specific

I tried to google this question, but found only options for how to change the local address, not a foreign one

Please give advice

ED9
  • 11
  • 2
  • 1
    You can use iptables, and allow only the ip's you want to access the port 5000. – António Campos May 20 '19 at 18:44
  • Wouldn't it be easier to filter the IP from inside your C# code? – CubanTurin May 20 '19 at 19:05
  • 1
    You can override host and port with an environment variable `ASPNETCORE_URLS=http://foo.bar:1234`. See [documentation](https://learn.microsoft.com/en-us/aspnet/core/fundamentals/host/web-host?view=aspnetcore-2.2#server-urls) – Kalten May 20 '19 at 19:29
  • Kalten, i tried .UseUrls, it changes local adress, not foreigh – ED9 May 20 '19 at 19:51

0 Answers0