Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Intercept and use local files in http requests

Tags:

I'm trying to find a tool that will allow non-programmers to test files on a live server.

For example, they could modify an image on their computer, reload a webpage, then see the results of their work immediately.

I've tried finding a tool for this, because it seems obvious enough that someone must've thought of it, but a lot of software I see doesn't quite fit. A tool called Fiddler does this (they call it autoresponding) but it's Windows-only. I could change the hosts file to redirect to a local instance of nginx or something, but that seems difficult to maintain when all I really want is a simple tool that will something like this...

http://someserver.com/css/(.*) -> /home/user/localcss/$1

Does anybody have any recommendations?

Edit: Redirect clarification

like image 920
max Avatar asked Jan 27 '11 20:01

max


People also ask

Can you intercept an HTTP request?

To intercept HTTP requests, use the webRequest API. This API enables you to add listeners for various stages of making an HTTP request. In the listeners, you can: Get access to request headers and bodies and response headers.

What is HTTP intercepting?

HTTP traffic passing through the proxy server can be intercepted. An intercepted request or response means the roundtrip is halted by the server, awaiting manual action. Stalled requests/responses can be inspected and (optionally) edited, before letting them continue to be sent/received.


2 Answers

Fiddler has this feature; just click the AutoResponder tab and map URLs to local files. Thousands of people do this every day.

See also video #5 here: http://www.fiddlerbook.com/fiddler/help/video/default.asp

like image 65
EricLaw Avatar answered Sep 16 '22 12:09

EricLaw


I found Charles Proxy very useful for this http://www.charlesproxy.com/documentation/tools/map-local/

like image 40
ghostCoder Avatar answered Sep 19 '22 12:09

ghostCoder