R
R
Regis2012-01-05 09:34:26
Nginx
Regis, 2012-01-05 09:34:26

How to replace the server response with a given file?

Situation: there is a server with a website to which there is no access to change.

Purpose: to make and test locally changes to one of the static JS files used on the site.

What is expected: when you open the site in my browser, one of the requests does not go to the server, but is read from my local disk.

Question: what is the best way to set up request substitution? What software can make this task as easy as possible?

Need a solution that works under Win.

PS: The solution that I present is: use a proxy server that will transfer all requests except the one you need to the server with the site, and the right one will be read from the disk; register this proxy server in the browser. Problem: I do not know ready-made proxy servers with the necessary functionality. I don't want to write mine. Although I'm ready to edit the server preparation in Python :)

Answer the question

In order to leave comments, you need to log in

5 answer(s)
A
Anton, 2012-01-05
@Regis

Still it is possible to organize similar through Fiddler. There, look at the AutoResponder tab - in it you can set a rule so that instead of a file from the server, some local file is given to the browser.
Although Fiddler is essentially also like a proxy.

A
abarmot, 2012-01-05
@abarmot

Nginx

C
chmv, 2012-01-05
@chmv

squid. A few years ago I set up a banner cutter on it in such a way that instead of advertising it gave me a picture from my http server. Those. just what you need. Some requests can be sent not to the original site, but to your own. That is, to fulfill a request, squid will not go to the original site, but wherever you say.

V
Vitaly Peretyatko, 2012-01-05
@viperet

The Charles desktop proxy can replace strings in HTTP responses/requests using regular expressions, and in general it can do a lot of things, it works under Win/Lin/Mac. This is for development/testing purposes.
And if for permanent use - nginx is placed in front of the site and the necessary file is replaced by its means.

H
homm, 2012-01-05
@homm

You for yourself and once?
Open the page in Opera that contains the script you need.
Open the desired script in another tab under the same name that is used on the page.
Open the source code of the script. Change what you want and click "apply changes".
Switch to an already open tab with the desired page and reload from the cache (in development tools).

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question