Web lists-archives.com

Re: iptables issue with ASP.Net Core Port 5000

On Wed, 13 Feb 2019 9:44 pm Patrick Kirk <patrick@xxxxxxxxx wrote:
Hi all,

I have a simple asp.net core site that runs with Postgres which works
fine if I login as root and set it to run on port 80.  SSL is done by
cloudflare.  I would prefer to use nginx or at least have an iptable
rule to redirect the port 80 traffic.  Both have the same failure so for
now I am trying with iptables.

I don't believe this is an issue with asp.net but the line I use to set
ports is:

public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>

To run the program on port 80, I have to run as root which I want to get
away from.  So I remove the port 80 from Program.cs and then run the
program.  Output of nmap is:

Starting Nmap 7.40 ( https://nmap.org ) at 2019-02-13 10:35 UTC
Nmap scan report for localhost (
Host is up (0.0000080s latency).
Not shown: 997 closed ports
22/tcp   open  ssh
5000/tcp open  upnp
5432/tcp open  postgresql

If I try the iptables route the command I use is:

  iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 5000

This works fine for Lynx http://localhost but for my url I get

"Alert!: HTTP/1.1 521 Origin Down"

If I try to use nginx, which I believe is configured correctly, I get
the exact same issue.

Has anyone any idea what's wrong with my setup?



$ sudo sysctl -w net.ipv4.ip_forward=1