2

Background

I'm trying to make a redirection setup to make it so that when I make a request to example.com it would be redirected to 127.0.0.1:3000.

I know that I can map example.com to 127.0.0.2 via /etc/hosts. Now I want to route 127.0.0.2:80 to 127.0.0.1:3000.

The problem

I'm using pfctl (that is default on Yosemite). There is the rule that I try to use:

rdr pass on lo0 inet proto tcp from 127.0.0.2 to 127.0.0.2 port http -> 127.0.0.1 port 3000

But it doesn't seem to work, I get timeout when trying to reach 127.0.0.2.

ave
  • 135

1 Answers1

0

Most probably, your source address isn't 127.0.0.2. ifconfig lo0 will show you your source address upon going toward the 127/8 network.

Then I would suggest you to change your rdr rule to a larger one:

rdr pass on lo0 inet proto tcp from any to 127.0.0.2 port http -> 127.0.0.1 port 3000
athena
  • 374
  • 2
  • 14