Currently we use a remote server to request dynamic and static content. For example:
http://myremoteserver.com/getContent.php?id=1
http://myremoteserver.com/image1.png
We would like to use a proxy server with these two case uses:
- If remote server is down, a cached version of our request is returned.
We would like to "hijack" some of the requests, so if we request:
http://myproxyserver.com/image1.png
our server may be able to return a different image than
image1.png
. Ideally, the image returned could be determined by a program.
Do you know if something like this already exists? That way we wouldn't need to re-implement it.
Edit to clarify a bit:
Dynamic requests such as http://myremoteserver.com/getContent.php?id=1
may return different results depending of its parameters. The response would be a JSON file. For id=1
a JSON is generated, for id=2
another JSON is generated, and so on. Depending the time the request is made, different results may be obtained for the same parameters.
In our program we have a config file file that has something like this:
server="http://myremoteserver.com"
and we would like to replace it by
server="http://myproxyserver.com"
Ideally, this proxy server should try to return the same response than remote server. So this proxy server will request the remote server. If the server is down, it will return its cached response, otherwise will return the same response than the remote server.
For some exceptional cases, let's say
http://myremoteserver.com/image1.png
http://myremoteserver.com/image2.png
http://myremoteserver.com/image7.png
we would like that different images are returned, for example image1000.png
, image1001.png
, image1002.png
respectively.