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've looking aroung the web, but I can't figure out how to do what I'm looking for. So what I'm looking for is a proxy on which will foward the HTTP query based on the IP address I've put in the url (GET).

So, for example :

I request : http://host/query/IP_A What it should do is : ME => GET HTTP myhost/query/IP_A => GET IP_A ===> GET HTTP query to IP_A and return to the sender!

I've been reading for proxypass, reverseproxy,proxymatch and mod_rewrite... but I can't figure out why it's not working at all! And I've no logs.... which is it not cool when came the debug time! :-(

here's my actual config :

<VirtualHost *:80>
 ServerName myServer
 DocumentRoot /home/me/www/htdocs
 #       RewriteCond ^.*/query/(.*)
 #       RewriteRule (.*) http://$1 [P]
 ProxyPassMatch ^.*/query/(.*) http://$1
 ErrorLog logs/me-error_log
 CustomLog logs/me-access_log debug

Here's a static working example :

ProxyPass / http://IP_A
ProxyPassReverse / http://IP_A

So when I access to the webserver, it direct to the IP and return me the http response.

Thx for the help!

share|improve this question
What's your use case here? As specified, it seems like a security nightmare. – EEAA Jul 30 '13 at 20:56
Yes, but there's always a way to secure : the access, and IP Range on which we allowed the HTTP query. And the server is only allow to make some query on some specific IP range. – user183729 Jul 31 '13 at 15:24
up vote 0 down vote accepted

Your use case is a little unclear. It sounds a lot like a normal web proxy (which accepts requests from your browser and then fetches content from the remote site on behalf of your browser).

But to do what you want:

<VirtualHost *:80>
    RewriteRule ^/query/(.*) http://$1 [P]
<VirtualHost *:80>

This will take anything about /query/ and append it to http://, and then make a proxy request for the result. As @EEAA said, this is a security nightmare (someone can use your server to attack a remote system), but it will do what you want.

You may want to read up on using Apache as a forward proxy (as described in the mod_proxy documentation, or here for example), and see if that meets your needs.

share|improve this answer
Hi! thx for the answers. Sorry if I was unclear, I taught I was! :-) I was reading about the mod_proxy but it doesn't seems that proxypass and proxyreverse can handle regex. For your info, my server only allow to do some HTTP query on specific IP address. Also, I guess the http query can be control by .htaccess so on a security point of view, it may be ok... event if it's not perfect. I'll give a try with your proposition. – user183729 Jul 31 '13 at 15:32
You're welcome. If this answer helped out, consider marking it as "accepted" by clicking on the checkbox at the upper left of the answer. – larsks Jul 31 '13 at 15:33

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.