You are viewing a plain text version of this content. The canonical link for it is here.
Posted to bugs@httpd.apache.org by bu...@apache.org on 2006/03/06 17:00:19 UTC

DO NOT REPLY [Bug 38864] New: - LocationMatch not working

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=38864>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=38864

           Summary: LocationMatch not working
           Product: Apache httpd-2
           Version: 2.2.0
          Platform: Other
        OS/Version: other
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Core
        AssignedTo: bugs@httpd.apache.org
        ReportedBy: douglas.acheson@bpsserver.com


I want to proxy (loadbalance) all jsp and frm requests to tomcat through the
proxy and LB modules, and I cannot.

  I have the proxying/LBing working correctly for the following:

<LocationMatch "/myproject">
  ProxyPass balancer://myCluster/myproject stickysession=JSESSIONID
  ProxyPassReverse balancer://myCluster/bpsproject
  Order Deny,Allow
  Allow from all
</LocationMatch>

Now, when I try to use a regular expression to proxy .jsp and .frm requests,
there is no proxying done all.  This is what I use:

<LocationMatch "^/myproject/.+\.(jsp|frm)$">
  ProxyPass        balancer://myCluster/myproject stickysession=JSESSIONID
  ProxyPassReverse balancer://myCluster/bpsproject
  Order Deny,Allow
  Allow from all
</LocationMatch>

In the error log I get a 404 error:
[Mon Mar 06 10:45:41 2006] [error] [client 10.0.0.152] File does not exist:
C:/dwfa/runtime/apache/httpd/html/myproject/login.jsp

I have tried this with win32 (got binary) and linux (built) with the same results.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


DO NOT REPLY [Bug 38864] - LocationMatch not working

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=38864>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=38864


douglas.acheson@bpsserver.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEEDINFO                    |RESOLVED
         Resolution|                            |FIXED




------- Additional Comments From douglas.acheson@bpsserver.com  2006-03-09 15:33 -------
Thanks I got it working.  Appreciate all your help ...

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


DO NOT REPLY [Bug 38864] - LocationMatch not working

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=38864>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=38864


rpluem@apache.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |NEEDINFO




------- Additional Comments From rpluem@apache.org  2006-03-08 20:37 -------
(In reply to comment #4)

> 
> 2.  Not sure why LocationMatch and proxy work to tightly.  Here is my simple
> view of how I thought it should work:
>   if the incoming URL matches the grammar supplied by the RE in LocationMatch
>     do the work (in this case proxy the request)
> I do not understand why proxy needs to know about RE as, IMHO, only
> LocationMatch needs to do the patching.

That is due to how the internal processing works. I admit that this is not
logical from a users perspective view. Basicly a ProxyPass inside a Location or
LocationMatch container is transformed to ProxyPass <string of
Locationcontainer> <proxytarget> during the parsing of the configuration. So in
your example this gets transformed to
ProxyPass ^/myproject/.+\.(jsp|frm)$ balancer://myCluster/myproject
Stickysession=JSESSIONID

As ProxyPass does not know anything about RE it tries to match the URL plain
against ^/myproject/.+\.(jsp|frm)$ which cannot work for obvious reasons.

> 
> 3. I really appreciate an alternate solution.  I have tried that and it does not
> work (as I expect).  If I take what you supplied I get tomcat serving up
> everything (jsp, gif, etc).  So I went and read up on RewriteRule and found 
out
> that I should use the [p] token at the end of the "rule".  When I tried this,

Ah, sorry a copy and paste error from my side. It should have been

RewriteRule (^/myproject/.+\.(jsp|frm)$) balancer://myCluster$1 [P]

Astonishing that this worked at all without the [P] flag.

> nothing works.  So I am really confused now.

It should work. I tested it in my environment. You have an error in your config
(see below)

> 
> 4.  I do not understand why the ProxyPassReverse is written in that manor.  Why
> does it use http as the protocol and why must I specify every member?  Should I
> not be able to use balancer as the protocol.

No. ProxyPassReverse works like a lookup table. It checks possible Location
headers of the HTTP responses from the backend and transforms them into the
correct ones (by using the lookup table) to make redirects work. But the backend
servers do know nothing about the balancer scheme. So they put in their local
name (http://127.0.0.1:8080 and http://127.0.0.1:8081 in your case) in their
Location headers.


> 
>   RewriteRule (^/myproject/.+\.(jsp|html|form))  balancer://myCluster$0
>   #RewriteRule (^/myproject/.+\.(jsp|html|form)) balancer://myCluster$0 [p]

The error is $0 at the end. It must be $1. Please use the line with the [P] flag
at the end.



-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


DO NOT REPLY [Bug 38864] - LocationMatch not working

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=38864>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=38864





------- Additional Comments From douglas.acheson@bpsserver.com  2006-03-08 19:36 -------
Thx your for your reply.  A couple of things:

1. I could not find, but does not mean it does not exist, documentation about
proxy and REs.  But, if it does not work, so be it.

2.  Not sure why LocationMatch and proxy work to tightly.  Here is my simple
view of how I thought it should work:
  if the incoming URL matches the grammar supplied by the RE in LocationMatch
    do the work (in this case proxy the request)
I do not understand why proxy needs to know about RE as, IMHO, only
LocationMatch needs to do the patching.

3. I really appreciate an alternate solution.  I have tried that and it does not
work (as I expect).  If I take what you supplied I get tomcat serving up
everything (jsp, gif, etc).  So I went and read up on RewriteRule and found out
that I should use the [p] token at the end of the "rule".  When I tried this,
nothing works.  So I am really confused now.

4.  I do not understand why the ProxyPassReverse is written in that manor.  Why
does it use http as the protocol and why must I specify every member?  Should I
not be able to use balancer as the protocol.

4.  Since my original defect report,t in all honestly has been resolved, I
understand if you want to close this ticket.

Here is my new snippet I used:

<IfDefine rewrite>
  RewriteEngine On
 
  <Proxy balancer://myCluster>
    BalancerMember ajp://10.0.0.152:8009 loadfactor=100 route=152
    BalancerMember ajp://10.0.0.153:8009 loadfactor=100 route=153
    ProxySet stickysession=JSESSIONID
    Order Deny,Allow
    Allow from all
  </Proxy>

  RewriteRule (^/myproject/.+\.(jsp|html|form))  balancer://myCluster$0
  #RewriteRule (^/myproject/.+\.(jsp|html|form)) balancer://myCluster$0 [p]

  ProxyPassReverse /myproject http://10.0.0.152:8080/myproject
  ProxyPassReverse /myproject http://10.0.0.153:8080/myproject

  <Location /balancer-manager>
    SetHandler balancer-manager
    Order Deny,Allow
    Allow from all
  </Location>

</IfDefine>

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


DO NOT REPLY [Bug 38864] - LocationMatch not working

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=38864>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=38864





------- Additional Comments From douglas.acheson@bpsserver.com  2006-03-06 20:49 -------
The configuration snipit is really
<LocationMatch "^/myproject/.+\.(jsp|frm)$">
  ProxyPass        balancer://myCluster/myproject stickysession=JSESSIONID
  ProxyPassReverse balancer://myCluster/myproject
  Order Deny,Allow
  Allow from all
</LocationMatch>

I had a typo in the one originally posted.  Still have tht same issue

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


DO NOT REPLY [Bug 38864] - LocationMatch not working

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=38864>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=38864





------- Additional Comments From kess@kess-net.de  2006-03-06 20:20 -------
*** Bug 38865 has been marked as a duplicate of this bug. ***

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


DO NOT REPLY [Bug 38864] - LocationMatch not working

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=38864>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=38864





------- Additional Comments From rpluem@apache.org  2006-03-06 21:24 -------
ProxyPass does not work with regular expressions. Thus it does not work inside
LocationMatch. Apart from the discussion if this is a bug and if yes if it is a
bug in the documentation or in the code you can use mod_rewrite to solve your
problem:

RewriteEngine on
RewriteRule (^/myproject/.+\.(jsp|frm)$) balancer://myCluster$1

<Proxy balancer://myCluster>
BalancerMember http://127.0.0.1:8080
BalancerMember http://127.0.0.1:8081 
ProxySet stickysession=JSESSIONID
</Proxy>

ProxyPassReverse /myproject http://127.0.0.1:8080/myproject
ProxyPassReverse /myproject http://127.0.0.1:8081/myproject

Please keep in mind that you MUST use ProxySet AFTER the BalancerMember directives.



-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org