I want to implement a proxy that records and replays requests made to specific hosts. So that I can stub out external service requests when testing an application.
What is the best way to do this? I have tried modifying the hosts file so that domain.com goes to my localhost, but then this prevents my proxy from then making requests to that domain.
Is there some combination of /etc/hosts change and iptables that I can use to achieve this?