homepage Welcome to WebmasterWorld Guest from 54.211.100.183
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

    
Rewrite URL with Load Balancing
Sreekul



 
Msg#: 4580937 posted 6:29 am on Jun 4, 2013 (gmt 0)

Hello Gurus,

I have a complex scenario below and I request your help on the same -
I have an Apache Server listening to Port 80.
I have two tomcats (AJP Ports 8009 and 8019 respectively) installed on the same machine.
Both these tomcats have exactly same WEB applications deployed. I am trying to load balance between the two tomcats via this apache web server.
So far its good. I have been able to establish load balancing via mod_jk as well as with mod_proxy_balancer.

Now comes the main concern. I have to rewrite the URL that goes to tomcat. Hence when the user types "mysite.com" in the address bar, I have to rewrite (or redirect) it to [mysite.com...] The WEB application myapp is present on both these tomcat servers.

I tried using the conventional RewriteRule or Redirect but to no avail. I have now discarded the mod_jk method and am using the mod_proxy method to load balance. My code as of now looks as follows -

<VirtualHost *:80>
ServerName mysite.com
ServerAlias www.mysite.com
ProxyPreserveHost On
<Location /balancer-manager>
SetHandler balancer-manager
Order Deny,Allow
Deny from none
Allow from all
</Location>
<Proxy balancer://mycluster>
BalancerMember ajp://<MyIPAddress>:8009
BalancerMember ajp://<MyIPAddress>:8019
</Proxy>
ProxyRequests Off
ProxyPass / balancer://mycluster/
RewriteRule ^/.*$ balancer://mycluster/myapp/ [L,PT]
</VirtualHost>

Please forbid my lack of knowledge on this subject but I am not a WEB Server Admin or a developer. I have still been through Apache site and tried different options but to no avail and now am really frustrated with this problem. Would really really appreciate if someone can provide me a resolution to this issue.

 

lucy24

WebmasterWorld Senior Member lucy24 us a WebmasterWorld Top Contributor of All Time Top Contributors Of The Month



 
Msg#: 4580937 posted 7:11 am on Jun 4, 2013 (gmt 0)

I have to rewrite (or redirect) it to http://example.com/myapp/logon.jsp

Careful there. Which do you mean? External redirect (send user somewhere else, with change in address bar) or internal rewrite (serve content from somewhere other than what user's address bar says)? I would have guessed internal rewrite, because a redirect-- by any method-- shouldn't be all that troublesome. But if you tried Redirect by that name (mod_alias), I guess you do mean an external redirect.

I tried using the conventional RewriteRule or Redirect but to no avail.

Nuh-uh, not so fast :) What EXACTLY did you try, and what EXACTLY happened when you tried it?

Please for[give] my lack of knowledge on this subject but I am not a WEB Server Admin or a developer.

Coulda fooled me, since the opening paragraphs of your post were so much Hungarian to me ;) Hastily editing quote because I have to assume that was the verb you intended

Sreekul



 
Msg#: 4580937 posted 7:52 am on Jun 4, 2013 (gmt 0)

Hello Lucy,

Thank you for your prompt reply.

By rewriting / redirection, I mean the external redirect. I am sending user somewhere else (to tomcat web application) and the content is retrieved from the place the URL directs to.

In the virtual hosts snippet, I had included a line stating -
Redirect / [mysite.com...]
or
Redirect / balancer://mycluster/myapp/logon.jsp
It seems like apache doesn't even realize this line exists. It just shows me the default tomcat home page.

I understand this is because of the proxy directive. I even tried removing ProxyPass directive and include only the RewriteRule as follows -
RewriteRule ^/.*$ balancer://mycluster/myapp/ [L,PT]
but then apache says the Internet explorer cannot display the web page.

have tried including the RewriteRule inside <Location /> directive but again to no avail.

One thing that works is ProxyPass directive if I do the following -
Remove RewriteRule from the above code snippet and -
ProxyPass / balancer://mycluster/myapp/logon.jsp instead of
ProxyPass / balancer://mycluster/
The logon.jsp page shows up correctly here. However, the URL is simply [mysite.com...] and not [mysite.com...]
I want the entire URL to be displayed.

Hope this clarifies my issue.

Thanks & Regards,
Sree

Sreekul



 
Msg#: 4580937 posted 8:05 am on Jun 4, 2013 (gmt 0)

Hi,

In simplest terms,

I want that the URL should show up in the address bar as
http://mysite.com/myapp/logon.jsp
but after apache has load balanced the request.

Thanks & Regards,
Sree

Sreekul



 
Msg#: 4580937 posted 12:32 pm on Jun 4, 2013 (gmt 0)

Hi,

Can anyone please help me with this issue ?

Thanks & Rgds,
Sree

Sreekul



 
Msg#: 4580937 posted 12:05 pm on Jun 5, 2013 (gmt 0)

Hello All,

After a lot of trial and error, I resolved the problem. The issue was that the redirection was supposed to be done first and then it was to be passed on to proxy.

The final code looks as below -

<VirtualHost *:80>
ServerName mysite.com
ServerAlias mysite.com
ProxyPreserveHost On
<Directory />
Options +Indexes +FollowSymLinks +ExecCGI
Order allow,deny
Allow from all
AllowOverride all
Require all granted
</Directory>
Redirect / http://mysite/myapp/logon.jsp
<Location /balancer-manager>
SetHandler balancer-manager
Order Deny,Allow
Deny from none
Allow from all
</Location>
<Proxy balancer://mycluster>
BalancerMember ajp://<Tomcat-IPAddress>:8009
BalancerMember ajp://<Tomcat-IPAddress>:8019
ProxySet stickysession=JSESSIONID|jsessionid lbmethod=bytraffic nofailover=Off
</Proxy>
ProxyRequests Off
ProxyPass /myapp balancer://mycluster
</VirtualHost>

Sreekul



 
Msg#: 4580937 posted 12:13 pm on Jun 5, 2013 (gmt 0)

Hi All,

As mentioned the issue has been resolved. However, there is a new issue that I am faced with.

My application myapp refers to another application (takes a logon page from this app) - say myapp1.

When I access myapp using tomcat via the URL -
http://mysite.com:8080/myapp/logon.jsp, the logon area (Fetched from myapp1) shows up correctly. However, when I use apache via the URL http://mysite.com/myapp/logon.jsp, this logon area shows internet explorer cannot display the web page. The rest of the page is rendered correctly.

Any idea why this is happening.
Request assistance in resolving this issue.

Thanks & Rgds,
Sree

lucy24

WebmasterWorld Senior Member lucy24 us a WebmasterWorld Top Contributor of All Time Top Contributors Of The Month



 
Msg#: 4580937 posted 8:32 pm on Jun 5, 2013 (gmt 0)

Never mind what you see in the browser. It's just repackaging information it gets from the server. What do you see in logs?

Sreekul



 
Msg#: 4580937 posted 5:45 am on Jun 6, 2013 (gmt 0)

Hello Lucy,

I guess I did something horrendously wrong. Though the initial myapp page appears correctly (except for the logon area), the logs reveal that I am not even close to a resolution.

The following shows up in the log as soon as I open execute the URL -
http://mysite.com/myapp :

10.48.11.70 - - [06/Jun/2013:10:44:31 +0530] "GET /myapp/logon.jsp HTTP/1.1" 200 12209
10.48.11.70 - - [06/Jun/2013:10:44:31 +0530] "GET /myapp/res/schema.blue/default.css
HTTP/1.1" 200 12581
10.48.11.70 - - [06/Jun/2013:10:44:31 +0530] "GET /myapp/js/utils.js HTTP/1.1" 200 30045
10.48.11.70 - - [06/Jun/2013:10:44:31 +0530] "GET /myapp/js/helpSystem.js
HTTP/1.1" 200 2665
10.48.11.70 - - [06/Jun/2013:10:44:31 +0530] "GET /myapp/res/general/logon_bo/logon_bo_01.jpg
HTTP/1.1" 200 17061
10.48.11.70 - - [06/Jun/2013:10:44:31 +0530] "GET /myapp/res/general/logon_bo/spacer.gif
HTTP/1.1" 200 43
10.48.11.70 - - [06/Jun/2013:10:44:31 +0530] "GET /myapp/res/general/logon_bo/logon_bo_02.jpg
HTTP/1.1" 200 57533
10.48.11.70 - - [06/Jun/2013:10:44:31 +0530] "GET /myapp/res/general/logon_bo/logon_bo_03.jpg
HTTP/1.1" 304 -
10.48.11.70 - - [06/Jun/2013:10:44:31 +0530] "GET /myapp/res/general/logon_bo/logon_bo_04.jpg
HTTP/1.1" 304 -
10.48.11.70 - - [06/Jun/2013:10:44:31 +0530] "GET /myapp/res/general/logon_bo/logon_bo_05.jpg
HTTP/1.1" 304 -
10.48.11.70 - - [06/Jun/2013:10:44:31 +0530] "GET /myapp/res/general/logon_bo/logon_bo_06.jpg
HTTP/1.1" 304 -
10.48.11.70 - - [06/Jun/2013:10:44:31 +0530] "GET /myapp/res/general/logon_bo/logon_bo_07.jpg
HTTP/1.1" 304 -
10.48.11.70 - - [06/Jun/2013:10:44:31 +0530] "GET /myapp/res/general/logon_bo/logon_bo_09.jpg
HTTP/1.1" 304 -
10.48.11.70 - - [06/Jun/2013:10:44:31 +0530] "GET /myapp/res/general/logon_bo/logon_bo_11.jpg
HTTP/1.1" 304 -
10.48.11.70 - - [06/Jun/2013:10:44:31 +0530] "GET /myapp/res/general/logon_bo/logon_bo_13.jpg
HTTP/1.1" 304 -
10.48.11.70 - - [06/Jun/2013:10:44:31 +0530] "GET /myapp/res/general/logon_bo/bg.gif
HTTP/1.1" 304 -
10.48.11.70 - - [06/Jun/2013:10:44:31 +0530] "GET /myapp/res/general/logon_bo/logo2.gif
HTTP/1.1" 304 -
10.48.11.70 - - [06/Jun/2013:10:44:31 +0530] "GET /myapp/jsp/listing/blank.jsp
HTTP/1.1" 200 29
10.48.11.70 - - [06/Jun/2013:10:44:31 +0530] "GET /myapp/logon/logonService.do?loc=en
HTTP/1.1" 200 1059
10.48.11.70 - - [06/Jun/2013:10:44:31 +0530] "POST /myapp1/service/app/logon.do?
HTTP/1.1" 302 271

10.48.11.70 - - [06/Jun/2013:10:44:31 +0530] "GET /myappmyapp1/service/app/logon.do?
HTTP/1.1" 302 279
10.48.11.70 - - [06/Jun/2013:10:44:31 +0530] "GET /myappmyappmyapp1/service/app/logon.do?
HTTP/1.1" 302 287
10.48.11.70 - - [06/Jun/2013:10:44:31 +0530] "GET /myappmyappmyappmyapp1/service/app/logon.do?
HTTP/1.1" 302 295
10.48.11.70 - - [06/Jun/2013:10:44:31 +0530] "GET /myappmyappmyappmyappmyapp1/service/app/logon.do?
HTTP/1.1" 302 303
10.48.11.70 - - [06/Jun/2013:10:44:31 +0530] "GET /myappmyappmyappmyappmyappmyapp1
/service/app/logon.do? HTTP/1.1" 302 311
10.48.11.70 - - [06/Jun/2013:10:44:31 +0530] "GET /myappmyappmyappmyappmyappmyappmyapp1
/service/app/logon.do? HTTP/1.1" 302 319
10.48.11.70 - - [06/Jun/2013:10:44:31 +0530] "GET /myappmyappmyappmyappmyappmyappmyappmyapp1
/service/app/logon.do? HTTP/1.1" 302 327
10.48.11.70 - - [06/Jun/2013:10:44:31 +0530] "GET /myappmyappmyappmyappmyappmyappmyappmyapp
...myapp1 /service/app/logon.do? HTTP/1.1" 302 335
10.48.11.70 - - [06/Jun/2013:10:44:31 +0530] "GET /myappmyappmyappmyappmyappmyappmyappmy
...appmyappmyapp1/service/app/logon.do? HTTP/1.1" 302 343
10.48.11.70 - - [06/Jun/2013:10:44:31 +0530] "GET /myappmyappmyappmyappmyapp
...myappmyappmyappmyappmyappmyapp1/service/app/logon.do? HTTP/1.1" 302 351
10.48.11.70 - - [06/Jun/2013:10:44:31 +0530] "GET /myappmyappmyappmyapp
...myappmyappmyappmyappmyappmyappmyappmyapp1/service/app/logon.do? HTTP/1.1" 302 359
10.48.11.70 - - [06/Jun/2013:10:44:31 +0530] "GET /...myappmyappmyappmyappmyapp
...myappmyappmyappmyappmyappmyappmyappmyapp1/service/app/logon.do? HTTP/1.1" 302 367
10.48.11.70 - - [06/Jun/2013:10:44:31 +0530] "GET /myappmyappmyappmyappmyappmyappmy
...appmyappmyappmyappmyappmyappmyappmyapp1/service/app/logon.do? HTTP/1.1" 302 375

etc, etc.

In the above log, after the first POST request (in bold), myapp gets appended for every subsequent line in the log and to the end of this line, there is myapp1/service/app/logon.do? which is the actual logon area.

This repetition with myapp being appended to every subsequent line goes on.

Not sure what am I doing wrong in here.

Thanks & Rdgs,
Sree

[edited by: tedster at 1:04 pm (utc) on Jun 6, 2013]
[edit reason] line breaks to avoid side scroll [/edit]

lucy24

WebmasterWorld Senior Member lucy24 us a WebmasterWorld Top Contributor of All Time Top Contributors Of The Month



 
Msg#: 4580937 posted 8:26 am on Jun 6, 2013 (gmt 0)

Ouch! I can see what's happening conceptually, but we'll need to figure out where the instruction is coming from.

In generic terms, this is what happens:

Server receives a request in the form
(.*some-stuff-here)
Acting on instructions, server issues a redirect to
morestuff$1
i.e.
morestuffsome-stuff-here

Browser puts in a fresh request.

Server receives a request in the form
(.*some-stuff-here)
Acting on instructions, server issues a redirect to
morestuff$1
i.e.
morestuffmorestuffsome-stuff-here

Browser puts in a fresh request.

Server receives a request in the form
(.*some-stuff-here)
Acting on instructions, server issues a redirect to
morestuff$1
i.e.
morestuffmorestuffmorestuffsome-stuff-here

Browser puts in a fresh request.

Server receives...

Well, you can see where this is going. Luckily your browser can see it too, because after a number of tries it puts its foot down and gives you an error message saying the request is redirecting in a way that will never go anywhere. Exact wording depends on the browser. If all it's saying is "Boo hoo, I can't display the page" it's not being very helpful ;)

On the other hand, the browser get points for perseverance. I make it 25 requests, while the last time I checked something similar, my own browser cut out at 10.

The fundamental problem is that your server is issuing a redirect based on the form of the request. There may or may not be a closing anchor; there definitely isn't an opening anchor. This is the lethal part, because the redirect involves adding some stuff to the front of the request. There's nothing in the redirect that says "only do this if the request doesn't already start with such-and-such", so the server will keep redirecting until the cows come home.

Now, I have no idea where the redirect is coming from, so I can't help you there. But since the redirect shows up in logs, I have to assume it's coming from the server, rather than from something like a login script. (That would show up in server logs as a 200, immediately followed by another request-- and another and another and another-- because the browser is receiving a 302 that wasn't issued by the server.)

Better have a closer look at your config file.

Sreekul



 
Msg#: 4580937 posted 9:13 am on Jun 6, 2013 (gmt 0)

Hello Lucy,

Thank you so much for a detailed overview.

Based on this, I tried a couple of more things in my httpd-vhosts.conf file. Below are the changes I made to this config file -
Prior to change -
Redirect / http://mysite/myapp/logon.jsp
ProxyPass /myapp balancer://mycluster/myapp

After change -

Redirect permanent / /myapp/
ProxyPass /myapp/ balancer://mycluster/myapp/

Note the change in ProxyPass - there is a '/' after /myapp which wasn't there earlier.

The issue didn't resolve after this. However, Now I found the following entries in the log -

10.48.11.70 - - [06/Jun/2013:14:36:12 +0530] "GET /myapp/logon.jsp HTTP/1.1" 200 12209
10.48.11.70 - - [06/Jun/2013:14:36:12 +0530] "GET /myapp/res/schema.blue/default.css HTTP/1.1" 200 12581
10.48.11.70 - - [06/Jun/2013:14:36:12 +0530] "GET /myapp/js/utils.js HTTP/1.1" 304 -
10.48.11.70 - - [06/Jun/2013:14:36:12 +0530] "GET /myapp/js/helpSystem.js HTTP/1.1" 200 2665
10.48.11.70 - - [06/Jun/2013:14:36:12 +0530] "GET /myapp/res/general/logon_bo/logon_bo_01.jpg HTTP/1.1" 200 17061
10.48.11.70 - - [06/Jun/2013:14:36:12 +0530] "GET /myapp/res/general/logon_bo/logon_bo_02.jpg HTTP/1.1" 200 57533
10.48.11.70 - - [06/Jun/2013:14:36:12 +0530] "GET /myapp/res/general/logon_bo/spacer.gif HTTP/1.1" 200 43
10.48.11.70 - - [06/Jun/2013:14:36:13 +0530] "GET /myapp/res/general/logon_bo/logon_bo_03.jpg HTTP/1.1" 304 -
10.48.11.70 - - [06/Jun/2013:14:36:13 +0530] "GET /myapp/res/general/logon_bo/logon_bo_04.jpg HTTP/1.1" 304 -
10.48.11.70 - - [06/Jun/2013:14:36:13 +0530] "GET /myapp/res/general/logon_bo/logon_bo_05.jpg HTTP/1.1" 304 -
10.48.11.70 - - [06/Jun/2013:14:36:13 +0530] "GET /myapp/res/general/logon_bo/logon_bo_06.jpg HTTP/1.1" 304 -
10.48.11.70 - - [06/Jun/2013:14:36:13 +0530] "GET /myapp/res/general/logon_bo/logon_bo_07.jpg HTTP/1.1" 304 -
10.48.11.70 - - [06/Jun/2013:14:36:13 +0530] "GET /myapp/res/general/logon_bo/logon_bo_09.jpg HTTP/1.1" 304 -
10.48.11.70 - - [06/Jun/2013:14:36:13 +0530] "GET /myapp/res/general/logon_bo/logon_bo_11.jpg HTTP/1.1" 304 -
10.48.11.70 - - [06/Jun/2013:14:36:13 +0530] "GET /myapp/res/general/logon_bo/logon_bo_13.jpg HTTP/1.1" 304 -
10.48.11.70 - - [06/Jun/2013:14:36:13 +0530] "GET /myapp/res/general/logon_bo/bg.gif HTTP/1.1" 304 -
10.48.11.70 - - [06/Jun/2013:14:36:13 +0530] "GET /myapp/res/general/logon_bo/logo2.gif HTTP/1.1" 304 -
10.48.11.70 - - [06/Jun/2013:14:36:13 +0530] "GET /myapp/jsp/listing/blank.jsp HTTP/1.1" 200 29
10.48.11.70 - - [06/Jun/2013:14:36:13 +0530] "GET /myapp/logon/logonService.do?loc=en HTTP/1.1" 200 1059
10.48.11.70 - - [06/Jun/2013:14:36:13 +0530] "POST /myapp1/service/app/logon.do? HTTP/1.1" 301 296
10.48.11.70 - - [06/Jun/2013:14:36:13 +0530] "GET /myapp/myapp1/service/app/logon.do? HTTP/1.1" 400 1175


The repetition has now been removed successfully. However, the logon area shows - HTTP Status 400 - Invalid path
/myapp1/service/app/logon was requested
The problem as I see now is that for every new internal redirect by my tomcat server, the Apache server now adds /myapp/ as is the case in the last GET request (highlighted).

Any ideas how to by pass that.

Thanks & Rgds,
Sree

lucy24

WebmasterWorld Senior Member lucy24 us a WebmasterWorld Top Contributor of All Time Top Contributors Of The Month



 
Msg#: 4580937 posted 9:37 am on Jun 6, 2013 (gmt 0)

for every new internal redirect by my tomcat server, the Apache server now adds /myapp/

Uhm... Yeah... It's doing it because you're telling it to.

Redirect permanent / /myapp/

"Every time you get a request containing a / directory slash, redirect it to the same place, adding /myapp at the front".

The only change is that redirects used to pile up as
/myappmyappmyappetcetera

and now they're going

/myapp/myapp/myappetcetera

except that thanks to the 400, the browser doesn't keep trying. ("The request could not be understood by the server due to malformed syntax. The client SHOULD NOT repeat the request without modifications.")

The problem happens one step earlier, though, with that initial redirect. Here we may need to find someone who speaks Apache, because I simply don't understand what the redirect is supposed to achieve. And the server doesn't understand either, because it thinks it's doing exactly what it has been told to do :(

From an earlier post:
ProxyPass / balancer://mycluster/
RewriteRule ^/.*$ balancer://mycluster/myapp/ [L,PT]
...
One thing that works is ProxyPass directive if I do the following -
Remove RewriteRule from the above code snippet and -
ProxyPass / balancer://mycluster/myapp/logon.jsp instead of
ProxyPass / balancer://mycluster/
The logon.jsp page shows up correctly here. However, the URL is simply http://example.com and not http://example.com/myapp/logon.jsp
I want the entire URL to be displayed.

Poor server! It keeps trying to do as it's told.

Incidentally, when you did the RewriteRule version did you say RewriteEngine On and Options +FollowSymLinks? I can't remember if they're required inside a VirtualHost envelope-- and it's 2:30 AM so this is not the time to refresh my memory.

Sreekul



 
Msg#: 4580937 posted 12:32 pm on Jun 6, 2013 (gmt 0)

I was so very happy an SAP BO personnel.
Really frustrated with Apache :( No offences to anyone.

The problem is that the Apache documentation is so ridicuously complex. Now thats proper Hungarian as Lucy calls it.

We use SAP BusinessObjects platform to cater to reporting requirements of the EndUsers. These users access SAP Business Objects via HTTP on the WEB. This requires a WebApplication Server which in our case is Tomcat. The tomcatservice (before apache was implemented) listens to port 80. Hence, the Users access BO by simply entering our "BO-Server-FQDN" in the addressbar. The moment this is done, the index.html page in the ROOT directory of tomcat is accessed. Here, I have the meta http-equiv="refresh" content="0; that redirects the user to the default SAP BO WEB application.

This worked beautifully. Then, one day, the client came up with FailSafeOver and Load-balancing mechanism to be implemented at WEB Tier level in BO. I, thence, implemented another tomcat server and an Apache server to load balance between the two tomcats.

The users however don't know anything about tomcat or apache. They want to access the BO reports the way they used to (by simply entering the BO ServerName in the addressbar). And this is where the redirection to the default SAP BO WEB Application comes into picture.
For obvious reasons, I used names like
mysite.com & /myapp and myapp1 .

I can easily achieve this in tomcat (via default index.html page) but for some reason, the client wants redirection via Apache.
Lucy, I hope its clear what the Redirect is trying to achieve.
I tried using a RewriteCondition and then a RewriteRule with a skip flag to create an If Else like statement as shown below -

RewriteCond %{REQUEST_URI} !=/myapp/
RewriteRule .? - [S=1] #First RewriteRule
RewriteRule (.*)/myapp/(.*) $1/$2 [L] #Second RewriteRule
RewriteRule ^/$ /myapp/ #Third RewriteRule

This ideally should first check if the URL doesn't have "/myapp/" as a part in it. If it doesn't, the condition returns true and hence the first RewriteRule is to be executed which skips the second RewriteRule and executes the third one. This as per the RewriteRule syntax should add /myapp/ in the URL (as is required).
If the condition returns false, the second rewrite rule is executed and the [L] flag ends the RewriteRule execution there. This second rule simply removes /myapp/.

This snippet doesn't work as well.

Any help would be appreciated.

Thanks & Rgds,
Sree

lucy24

WebmasterWorld Senior Member lucy24 us a WebmasterWorld Top Contributor of All Time Top Contributors Of The Month



 
Msg#: 4580937 posted 6:37 pm on Jun 6, 2013 (gmt 0)

I used names like mysite.com

You have to use example.com. You can say .org or .net or any tld you like-- including made-up ones-- but it has to be "example" to prevent auto-linking. This is a general WebmasterWorld rule that goes double in Apache because we need to see what you wrote.

This snippet doesn't work as well.

Does it still not work if the #comment part is put on a line of its own? I can't remember seeing this anywhere in docs-- but in real life Apache doesn't seem to like partial-line comments. I tend to get an error saying (in English) "I don't understand this flag".

RewriteCond %{REQUEST_URI} !=/myapp/
RewriteRule .? - [S=1]

Seems like you could do it the other way around and not have to bother about skips. Leave out Rule 1 altogether. Then give Rule 3, where the requested URI is /myapp/, and then Rule 2 ... except that a request containing /myapp/ will never match ^/$ so why are you skipping to this rule?

This package
RewriteRule (.*)/myapp/(.*) $1/$2 [L]
RewriteRule ^/$ /myapp/

is odd anyway. "If request contains /myapp/, serve content from a location that omits /myapp/. If request does not contain /myapp/ (or anything else), serve content from /myapp/". Is the [L] intentionally omitted here? Seems like this pair of rewrites would send you around in circles forever. (I'm not saying anything about the leading .* here because it's secondary to the main problem.)

Coming back to this:
ProxyPass / balancer://mycluster/myapp/logon.jsp
...
The logon.jsp page shows up correctly here.

So you do have the correct syntax, you just need to fine-tune the wording. It can't say /myapp/ twice-- once in the redirect itself and once more in the proxy declaration-- or you'll get the infinite redirect cycle you noticed earlier. You may also need a RewriteCond that says (in Engish) "only do this if the request has not already been pointed at the balancer".

:: looking around unhappily for g1smd or someone like him ::

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved