To emulate the CI integration testing environment for the application that I’m working with, I want to be able to have the following mapping of requests happen:
- foo:8080 ⟶ localhost:8081
- bar:8080 ⟶ localhost:8080
Without the port change, I can do this easily enough by editing /etc/hosts
¹ to define foo and bar to be 127.0.0.1, but the port forwarding has me stumped. Is this possible with pf
and if so, how? I’ve found recipes that would map all requests to port 8080 to a different port, but I only want it remapped if it’s a specific hostname.
- I have a vague recollection that Network Utility used to provide this capability but it is now deprecated.