Changes with .dev
domains in
mind.
Step 1 : Assign at least two IP address to your MAC OS (one per domain), let's say :
192.168.0.51
192.168.0.52
To setup the second IP you will have to add a second Ethernet Adapter (logical not physical).
Step 2 : As you don't have a DNS server, you could setup your /etc/hosts
file, by adding :
192.168.0.51 dev.hostone.com
192.168.0.52 dev.hosttwo.com
Step 3 : Assign aliases to your loopback interface :
sudo ifconfig lo0 192.168.0.51 alias
sudo ifconfig lo0 192.168.0.52 alias
Create /etc/pf.anchors/dev
, containing:
rdr pass inet proto tcp from any to 192.168.0.51 port 80 -> 127.0.0.1 port 8000
rdr pass inet proto tcp from any to 192.168.0.52 port 80 -> 127.0.0.1 port 3000
Edit /etc/pf.conf
. After rdr-anchor "com.apple/*"
insert rdr-anchor "dev"
(on its own line). After load anchor "com.apple" from "/etc/pf.anchors/com.apple"
insert load anchor "dev" from "/etc/pf.anchors/dev"
(again on its own line). It'll look something like this:
scrub-anchor "com.apple/*"
nat-anchor "com.apple/*"
rdr-anchor "com.apple/*"
rdr-anchor "dev"
dummynet-anchor "com.apple/*"
anchor "com.apple/*"
load anchor "com.apple" from "/etc/pf.anchors/com.apple"
load anchor "dev" from "/etc/pf.anchors/dev"
Test the config:
sudo pfctl -v -n -f /etc/pf.conf
Then reload:
sudo pfctl -ef /etc/pf.conf
how to use HTTPS? like https://dev.hostone.com