You need to run a web server (assuming we're talking about HTTP requests) on localhost
which redirects or proxies requests to pathToResource
to the remote path. For example, create an .htaccess file in the document root of your web server (~/Sites
for the built-in Apache server) with something like:
RewriteEngine On
RewriteRule ^pathToResource$ http://<serverIp>/pathToResource [R]
# or
RewriteRule ^pathToResource$ http://<serverIp>/pathToResource [P]
The first rule will redirect any request to the remote URL (clients are instructed to visit the other URL), the second one will proxy it (get the data and return it as if the remote resource was hosted locally).