Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need to configure a proxy on a machine A in a network X. Then I need to connect a client (smartphone) on this same network X but having the proxy configuration as the one prepared on the machine A. So basically, the smartphone is going to pass through Machine A before reaching internet and receiving the remote response.

I tried with Apache and his module.

What I really need to do, it's that when the client (smartphone) asks for an specific URL (Google i.e.), the Proxy Server have to filter the request and send it to a PHP script programmed to attend the request and send an specific answer to the client (and NOT the remote server response original one). For all the other requests (webs and sites), everything is going to be normal (not filtered by the proxy server).

I tried with a Forward Proxy on Apache, but I just get the tracking on the log access file. Nothing more. I can't create a "redirection" for specific requests.

Then I thought of a Reverse Proxy, trying to redirect the specific ones to a local place via ProxyPass and ProxyPassReverse. Didn't worked. Seems that Reverse Proxy only works for local asks to be resolved on the exterior or interior. But not to work for resolving exterior requests to a local ones.

Then I tried to play with, and played with "SetOutputFilter", creating a call to php.exe (Windows implementation) and a particular test.php script to print the $_SERVER array, and I managed to view the correct REQUEST_URI from my smartphone (client), printing a file to "C:\".

But then, when script finishes, the client receives no answer. So this doesn't seems to be the good approach too.

What should I do? Someone talked to me about SQUID and Content Adaptation, but I'm not sure about it.

share|improve this question
up vote 0 down vote accepted

Squid with an external redirector will do exactly what you want. You'll have it rewrite certain requests to point to the PHP script on your local server, while allowing other requests to pass through to the Internet.

An external redirector is simply a small program that receives requests from squid on stdin, rewrites them as necessary, and then returns them to squid on stdout.

share|improve this answer
Mmmm... pretty much interesting. Thanks! I'm going to take a look on it. Anyway, just imagine that the client (smartphone) is waiting for an XML response. I would want to create my own XML on PHP module on the proxy machine for a certain requests (URL). So what I really need to modify (create) is the content of the response to the client and not the HTTP header itself... is it possible with this? Thanks! – Lightworker Jan 22 '11 at 12:31
When using the redirector, you are responsible for generating the entire response -- header and data. – larsks Jan 22 '11 at 13:36
Hell yes! So I'm going to take a huge look on this! Man, you make my day! When I tried and if it works, I'm going to "tick" you answer ;) Thanks! – Lightworker Jan 22 '11 at 14:33
Fun reading: upside-down images with a squid redirector – larsks Jan 22 '11 at 15:59
LoooooL! Great one! :D – Lightworker Jan 22 '11 at 18:16

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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