Map Local (like Charles Proxy) using Open Source

If you are looking for an open-source solution, then Privoxy might be a solution.

Privoxy can do redirect actions and much more.
These examples were taken from the manual :

# Replace example.com's style sheet with another one
{ +redirect{http://localhost/example.com.css} }
example.com/stylesheet\.css$

# Redirect remote requests for this manual
# to the local version delivered by Privoxy
{+redirect{s@^http://www@http://config@}}
www.privoxy.org/user-manual/