3

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.

  • 1
    How do you want to differentiate between the two? Everything with a ? in it is dynamic? Or by extension? Apache can do this for you but to figure out the required mods and their configuration needs more detail in your question. – Angelo Fuchs Dec 23 '14 at 12:17
  • Thanks for your response, I have edited my question with more details. Thanks also for pointing Apache, we were wondering if it would be possible to generate an .htaccess with some mod_rewrite rules to achieve this. Looks like this may be the right direction. – ordago Dec 23 '14 at 12:29
  • 3
    You should especially take a look at the Apache mod_proxy module and its ProxyPassMatch directive. Have not tried it myself, but looks like something you should consider :) – Izzy Dec 23 '14 at 13:51
  • Thanks, I didn't know mod_proxy existed :) I will definitely look into it. – ordago Dec 23 '14 at 13:57
1

WinGate has a fairly powerful event-driven policy framework which allows you to do this. You can modify requests, divert requests, or serve requests directly from a local file (or even CGI e.g. PHP) instead of from the remote server.

We offer free support, and also a free license for 10 concurrent users.

Disclaimer: I work for Qbik who are the authors of WinGate.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.