Re: ProxyPass does not work inside LocationMatch
Bill Barker wrote: I'm mostly against it. It adds a lot of complexity that is more likely to lead users to trying things that simply won't work. e.g.: DirectoryIndex index.jsp index.html index.php LocationMatch *.jsp ProxyPass ajp://localhost:8009/ /LocationMatch Which will send all requests for an index page to Tomcat, even if there isn't an index.jsp file present. Is there a solution to this problem? This doesn't work: DirectoryIndex index.cgir index.php index.html FilesMatch \.(cgi|cgir|php3|php)$ RewriteRule ^/(.*)$ proxy:http://www-modperl:/$1 /FilesMatch index.cgir and index.php are returned un-proxied (although the proper one is picked). -- Mike Cramer http://www.webkist.com/ | AIM: MikeWebkist
Re: ProxyPass does not work inside LocationMatch
Is there a solution to this problem? This doesn't work: DirectoryIndex index.cgir index.php index.html FilesMatch \.(cgi|cgir|php3|php)$ RewriteRule ^/(.*)$ proxy:http://www-modperl:/$1 /FilesMatch Something like RewriteCond %{REQUEST_URI} \.(cgi|cgir|php3|php)$ RewriteRule ^/(.*) http://www-modperl:/$1 [P] Joost
Re: ProxyPass does not work inside LocationMatch
Joost de Heer wrote: RewriteCond %{REQUEST_URI} \.(cgi|cgir|php3|php)$ RewriteRule ^/(.*) http://www-modperl:/$1 [P] That works fine in 1.3, but 2.0 and 2.2 fail. I've tried five different versions in a couple of different ways[*]: IfDefine PROXY1 # Picks the first DirectoryIndex entry, even if it doesn't exist. RewriteCond %{REQUEST_URI} \.(cgi|cgir|php3|php|ephtml)$ RewriteRule ^/(.*)$ proxy:http://www-modperl:/$1 /IfDefine IfDefine PROXY2 # Returns unproxied contents if proxied item is an SSI: !--#include virtual=blah.cgi - RewriteCond %{REQUEST_URI} \.(cgi|cgir|php3|php|ephtml)$ RewriteRule ^/(.*)$ proxy:http://www-modperl:/$1 [NS] /IfDefine IfDefine PROXY3 # Passes all tests except the performance is horrendous. RewriteCond %{REQUEST_URI} /$ RewriteCond %{LA-U:REQUEST_FILENAME} \.(cgi|cgir|php3|php|ephtml)$ RewriteRule ^/(.*)$ proxy:http://www-modperl:/$1 [NS] RewriteCond %{REQUEST_URI} \.(cgi|cgir|php3|php|ephtml)$ RewriteRule ^/(.*)$ proxy:http://www-modperl:/$1 /IfDefine IfDefine PROXY4 # Returns unproxied file in all tests. FilesMatch \.(cgi|cgir|php3|php|ephtml)$ RewriteRule ^/(.*)$ proxy:http://www-modperl:/$1 /FilesMatch /IfDefine IfDefine PROXY5 # 400 Bad Request for all cases RewriteCond %{SCRIPT_FILENAME} \.(cgi|cgir|php3|php|ephtml)$ RewriteRule ^/(.*)$ proxy:http://www-modperl:/$1 [PT] /IfDefine Most of them work in certain cases. Only PROXY3 works in every case case I've tried, but it suffers from an explosion of subrequests that destroys performance under even moderate load. Some, like PROXY5 are obviously wrong but others, like PROXY4, make reasonable sense. *: The tests were: 1) request for /foo/, where index.html had a SSI directive calling a proxied file. 2) Same as one, but requesting index.html directly, avoiding DirectoryIndex. 3) Requesting proxied file directly: /foo/bar.cgir 4) Requesting /foo/, where DirectoryIndex should choose index.cgir. -- Mike Cramer http://www.webkist.com/ | AIM: MikeWebkist
Re: ProxyPass does not work inside LocationMatch
Ruediger Pluem wrote: Should we make ProxyPass aware of regular expressions, such that it works inside of a LocationMatch? I think that the principle of least astonishment should hold, in other words it should work from within LocationMatch. I can't think of a reason why it shouldn't work, and so would a new user trying out ProxyPass for the first time. Regards, Graham -- smime.p7s Description: S/MIME Cryptographic Signature
Re: ProxyPass does not work inside LocationMatch
On 03/12/2006 08:51 AM, Nick Kew wrote: On Sunday 12 March 2006 00:26, Ruediger Pluem wrote: The basic problem is putting directives on the server_rec and then hacking them to work inside Location. The original bug was with ProxyPassReverse, where multiple Locations in a virtualhost would just overwrite each other. Thinking back, at the time I fixed that, I am not really sure that they overwrite each other when they are used in multiple Locations. But even if they do and we fix this in the same way as you did for ProxyPassReverse and friends, ProxyPass still does not know how to handle RE. And if we want to make it aware of RE the next question to me is if we shouldn't create an additional directive ProxyPassMatch. AFAIK we always have two versions of directives when it comes to RE. One without and one with RE support. Using the mod_rewrite way to offer Location(Match) support by adding a fixup hook that handles the ProxyPass cases inside a Location(Match) might also not work, because this is too late for a proxy_walk which is done in the map_to_storage hook. But AFAICS we need to do the proxy_walk before the security phase, which happens before the fixup hook. Handling it in the same way as it currently works for Location also seems to throw up some questions. I guess we whould need to transform some configurations if ProxyPass / ProxyPassMatch is used in the wrong container: Location / ProxyPassMatch http://somewhere/ /Location should become Location / ProxyPass http://somewhere/ /Location and LocationMatch .*\.jsp$ ProxyPass http://somewhere/ /LocationMatch should become LocationMatch .*\.jsp$ ProxyPassMatch http://somewhere/ /LocationMatch or should it become LocationMatch (.*\.jsp$) ProxyPassMatch http://somewhere/$1 /LocationMatch ? So the more I look into this the more complicated it seems to me. Regards Rüdiger
Re: ProxyPass does not work inside LocationMatch
Nick Kew wrote: On Sunday 12 March 2006 00:26, Ruediger Pluem wrote: PR 38864 (http://issues.apache.org/bugzilla/show_bug.cgi?id=38864) revealed that ProxyPass does not work inside LocationMatch if LocationMatch uses a regular expression (which might be a frequent use of it :-)). I helped the reporter by pointing him to a working mod_rewrite configuration that does what he needs. The question that remains to me is: Should we make ProxyPass aware of regular expressions, such that it works inside of a LocationMatch? Actually it's worse than that. But AFAICS simpler to fix. I really, *really* should have fixed it when I fixed the same problem in ProxyPassReverse and friends, in http://svn.apache.org/viewcvs.cgi?rev=231355view=rev The basic problem is putting directives on the server_rec and then hacking them to work inside Location. The original bug was with ProxyPassReverse, where multiple Locations in a virtualhost would just overwrite each other. Thinking back, at the time I fixed that, I'd just never considered using ProxyPass in Location, and didn't realise it was supposed to work! So, any reason not to apply the same fix? +1. This is the way to do it, IMO. -- === Jim Jagielski [|] [EMAIL PROTECTED] [|] http://www.jaguNET.com/ If you can dodge a wrench, you can dodge a ball.
ProxyPass does not work inside LocationMatch
PR 38864 (http://issues.apache.org/bugzilla/show_bug.cgi?id=38864) revealed that ProxyPass does not work inside LocationMatch if LocationMatch uses a regular expression (which might be a frequent use of it :-)). I helped the reporter by pointing him to a working mod_rewrite configuration that does what he needs. The question that remains to me is: Should we make ProxyPass aware of regular expressions, such that it works inside of a LocationMatch? or should we just add a warning to the docs that ProxyPass does work inside of Location but not inside of LocationMatch? I am undecided. As I am used to mod_rewrite I do not miss RE for ProxyPass and from my feeling too much work needs to be done for too little gain, OTH it might be nice for people who do not want to use mod_rewrite for these comparable simple tasks. Regards Rüdiger
Re: ProxyPass does not work inside LocationMatch
Ruediger Pluem [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] PR 38864 (http://issues.apache.org/bugzilla/show_bug.cgi?id=38864) revealed that ProxyPass does not work inside LocationMatch if LocationMatch uses a regular expression (which might be a frequent use of it :-)). I helped the reporter by pointing him to a working mod_rewrite configuration that does what he needs. Yup, I've known that for for some time now :). The question that remains to me is: Should we make ProxyPass aware of regular expressions, such that it works inside of a LocationMatch? I'm mostly against it. It adds a lot of complexity that is more likely to lead users to trying things that simply won't work. e.g.: DirectoryIndex index.jsp index.html index.php LocationMatch *.jsp ProxyPass ajp://localhost:8009/ /LocationMatch Which will send all requests for an index page to Tomcat, even if there isn't an index.jsp file present. disclaimer My vote doesn't count on this list. I'm just a lurker. /disclaimer or should we just add a warning to the docs that ProxyPass does work inside of Location but not inside of LocationMatch? I am undecided. As I am used to mod_rewrite I do not miss RE for ProxyPass and from my feeling too much work needs to be done for too little gain, OTH it might be nice for people who do not want to use mod_rewrite for these comparable simple tasks. My vote (non-binding) is to go with your gut feeling. Regards Rüdiger
Re: ProxyPass does not work inside LocationMatch
On Sunday 12 March 2006 00:26, Ruediger Pluem wrote: PR 38864 (http://issues.apache.org/bugzilla/show_bug.cgi?id=38864) revealed that ProxyPass does not work inside LocationMatch if LocationMatch uses a regular expression (which might be a frequent use of it :-)). I helped the reporter by pointing him to a working mod_rewrite configuration that does what he needs. The question that remains to me is: Should we make ProxyPass aware of regular expressions, such that it works inside of a LocationMatch? Actually it's worse than that. But AFAICS simpler to fix. I really, *really* should have fixed it when I fixed the same problem in ProxyPassReverse and friends, in http://svn.apache.org/viewcvs.cgi?rev=231355view=rev The basic problem is putting directives on the server_rec and then hacking them to work inside Location. The original bug was with ProxyPassReverse, where multiple Locations in a virtualhost would just overwrite each other. Thinking back, at the time I fixed that, I'd just never considered using ProxyPass in Location, and didn't realise it was supposed to work! So, any reason not to apply the same fix? -- Nick Kew