I have a server listening on port
localhost. I want incoming traffic to
localhost:8080 to be forwarded to that server.
My set up:
- Server listens on port
3000; nothing listens on port
rdr pass log on lo0 proto tcp from any to any port 8080 -> 127.0.0.1 port 3000
- watch all incoming connections to port
sudo tcpdump -nn -i lo0 dst port 8080 -v
- server on port
3000gets request from curl
- tcpdump returns smth like: 127.0.0.1.57330 > 127.0.0.1.3000 < more-info >
- curl gets
curl: (7) Failed to connect to localhost port 8080: Connection refuse
- tcpdump returns 127.0.0.1.57330 > 127.0.0.1.8080 < more-info >
=> tcpdump output means that the rule was not applied since the destination port is still 8080 and not 3000.
Where did my configuration went wrong and how to make it right?