4

I am using IBM's IHS Webserver built on top of Apache Web server Version 2.2.4.

My requirement is to proxy pass a various Context path using regular expression in match.

I tried using ProxyPassMatch but I get below error

ERROR: "Invalid ProxyPass|ProxyPassMatch parameter. Parameter must be in the form 'key=value'"

<LocationMatch "^/(ae/en|ar/en|ar/es|at/en|au/en|be/en|br/en)/">
Order Allow,Deny
Allow from all
ProxyPass http://www.xyz.com.au:80/au/en/      #(should keep varying as per the regex matched in location match )
ProxyReverse http://www.xyz.com.au:80/au/en/   #(should keep varying as per the regex matched in location match )
</LocationMatch>

Kindly advice how this can be achieved.

Regards Sridhar

MKaama
  • 1,732
  • 2
  • 19
  • 28
user3140950
  • 41
  • 1
  • 1
  • 4

3 Answers3

10

If you put ProxyPassMatch iside a LocationMatch section, the first argument to ProxyPassMatch (regex) must be omitted. It will come from LocationMatch. Example from my (working) configuration:

<VirtualHost *:80>
ServerName gopal.lv
ServerAlias gopal.lv www.gopal.lv
ProxyPreserveHost On

<LocationMatch "^/(img|js|css|att|thumb|banner)/(.+)$">
#Note: only 1 argument here
ProxyPassMatch "http://192.168.1.11/$1/$2"
</LocationMatch>

#Note we have 2 arguments here
ProxyPassMatch "^/(img|js|css|att|thumb|banner)/(.+)$" "http://192.168.1.11/$1/$2"
ProxyPass / http://192.168.1.12/

</VirtualHost>

Otherwise, you get the error

ERROR: "Invalid ProxyPass|ProxyPassMatch parameter. Parameter must be in the form 'key=value'"

It is documented here: https://httpd.apache.org/docs/trunk/mod/mod_proxy.html#proxypass

Chris Stryczynski
  • 30,145
  • 48
  • 175
  • 286
MKaama
  • 1,732
  • 2
  • 19
  • 28
2

Always use separate lines for comments, and quote the string arguments. There where bug regathering this thing in their bugzila, but I believe you are not using an old version. https://bz.apache.org/bugzilla/show_bug.cgi?id=40439

<LocationMatch "^/(ae/en|ar/en|ar/es|at/en|au/en|be/en|br/en)/">
Order Allow,Deny
Allow from all
#should keep varying as per the regex matched in location match
ProxyPass "http://www.xyz.com.au:80/au/en/"
#should keep varying as per the regex matched in location match
ProxyReverse "http://www.xyz.com.au:80/au/en/" 
</LocationMatch>
Edik Mkoyan
  • 309
  • 2
  • 17
0

ERROR: "Invalid ProxyPass|ProxyPassMatch parameter. Parameter must be in the form 'key=value'"

This may occur if you have e.g. used RewriteUrl-flags at the end of your Proxy-directive.

dr0i
  • 2,380
  • 2
  • 19
  • 36