Hi I'm trying to set ProxyPass to pass requested URL as GET parameter to destination URL, but I can't figure out how to write it in the config file.

I tried something like this:

ProxyPass ^(.*)$ http://example.com/?url=$1
ProxyPassReverse ^(.*)$  http://example.com/?url=$1

but it doesn't work. Can you help me please? Thanks!

  • For clarity, even if you were using ProxyPassMatch, you do understand that ^(.*)$ matches only the part of the URL that follows the "domain"? For example, if the URL for the request is http://proxy.com/foo/bar/file.ext the match (i.e., the $1) will be foo/bar/file.ext, without the http://proxy.com/. Also, any query string following file.ext will be automatically appended after the $1, but as noted in answer below you cannot in a ProxyMatch specify a query string as part of the target url
    – Colt
    May 14, 2016 at 14:09

1 Answer 1


You should be using the ProxyPassMatch directive, if you want to use a regex, BUT as noted in the ProxyPass directive documentation

url is a partial URL for the remote server and cannot include a query string.

As a result, you are going to have to use a RewriteRule directive and set the [P] flag to cause the request to be handled as a proxy request by mod_proxy.

Although this probably needs some tweaking, a starting point might be:

RewriteEngine On
RewriteCond %{REQUEST_URI} !^/foo
RewriteRule ^(.*)$ /foo?url=$1 [P]
ProxyPass /foo http://example.com/
ProxyPassReverse /foo http://example.com/

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .