You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Tom Evans <te...@googlemail.com> on 2010/07/01 10:49:22 UTC

Re: [users@httpd] ProxyPass work correctly but ReWriteRule has some error

On Thu, Jul 1, 2010 at 7:32 AM, Tapas Mishra <mi...@gmail.com> wrote:
> I have an application which is accessible on LAN as
> http://192.168.1.5:8080/olat/
>
> it is a java application
> my proxy pass rule work correctly for this as follows
>
>
>        ProxyPass /olat http://192.168.1.5:8080/olat
>       ProxyPassReverse /olat http://192.168.1.5:8080/olat
>
> I am not able to write correct ReWriteRule for this I wrote the following
>
>
>          <IfModule mod_rewrite.c>
>        ReWriteEngine on
>         RewriteRule ^/olat/ http://192.168.1.5:8080/olat [P,L]
>       </IfModule>
>
> in browser I typed http://mydomain.com/olat then with ProxyPass I was
> able to access the application but with above ReWriteRule I was not
> able to access what can be the problem in ReWriteRule above ?
> --
> Tapas
> http://mightydreams.blogspot.com
> http://wiki.xensource.com/xenwiki/Xen_on_4_app_servers

Really? You can't see what's wrong there?

Your rewrite rule says to look for the URLs beginning with '/olat/'
and you went to '/olat'.

You shouldn't be using rewrite to initiate proxying unless your
situation is strange or bizarre - and if you have control over your
situation, don't make it strange or bizarre.

Also, your question reminds me of an english saying:

Patient: Doctor, it hurts when I do this: *patient waves his arm around*
Doctor: Don't do that then....

You have it working in the correct manner, and then break it and say
woe is me :/

Cheers

Tom

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] ProxyPass work correctly but ReWriteRule has some error

Posted by Tapas Mishra <mi...@gmail.com>.
On Thu, Jul 1, 2010 at 7:28 PM, Tom Evans <te...@googlemail.com> wrote:
> Look at your configuration again. First, ProxyPass
>
>      ProxyPass /olat http://192.168.1.5:8080/olat
>      ProxyPassReverse /olat http://192.168.1.5:8080/olat
>
> This says, when someone requests a URL starting with '/olat', proxy to
> 'http://192.168.1.5:8080/olat'
> It also says to rewrite some headers, but thats not important right now.
>
> Now, your RewriteRule version:
>
>      RewriteRule ^/olat/ http://192.168.1.5:8080/olat [P,L]
>
> This says, when someone requests a URL that begins with '/olat/',
> proxy to 'http://192.168.1.5:8080/olat'
>
>
> Can you really not see the difference?

Here you are saying about the / at the end is that what you mean?

> Let me show you with some URLs, and show what they get proxied to in
> each version. PR = Proxy rule, RR = Rewrite
>
> URL: /olat/
> PR: http://192.168.1.5:8080/olat/
> RR: http://192.168.1.5:8080/olat
When a request comes for /olat/ then it gets proxied to PR:
http://192.168.1.5:8080/olat/
and via RR it goes to PR: http://192.168.1.5:8080/olat
in this case I do not get the difference.
The url has a / at the end in PR so in RR also I should have a /
as you mentioned below

> URL: /olat/media/base.css
> PR: http://192.168.1.5:8080/olat/media/base.css
> RR: http://192.168.1.5:8080/olatmedia/base.css
>
> URL: /olat
> PR: http://192.168.1.5:8080/olat
> RR: None, attempts to serve the file /olat from your document root

Here why it tries to serve from DocumentRoot Not clear with this?


-- 
Tapas

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] ProxyPass work correctly but ReWriteRule has some error

Posted by Tapas Mishra <mi...@gmail.com>.
Ok I got all thanks got it.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] ProxyPass work correctly but ReWriteRule has some error

Posted by Tom Evans <te...@googlemail.com>.
Look at your configuration again. First, ProxyPass

      ProxyPass /olat http://192.168.1.5:8080/olat
      ProxyPassReverse /olat http://192.168.1.5:8080/olat

This says, when someone requests a URL starting with '/olat', proxy to
'http://192.168.1.5:8080/olat'
It also says to rewrite some headers, but thats not important right now.

Now, your RewriteRule version:

      RewriteRule ^/olat/ http://192.168.1.5:8080/olat [P,L]

This says, when someone requests a URL that begins with '/olat/',
proxy to 'http://192.168.1.5:8080/olat'


Can you really not see the difference?

Let me show you with some URLs, and show what they get proxied to in
each version. PR = Proxy rule, RR = Rewrite

URL: /olat/
PR: http://192.168.1.5:8080/olat/
RR: http://192.168.1.5:8080/olat

URL: /olat/media/base.css
PR: http://192.168.1.5:8080/olat/media/base.css
RR: http://192.168.1.5:8080/olatmedia/base.css

URL: /olat
PR: http://192.168.1.5:8080/olat
RR: None, attempts to serve the file /olat from your document root

I hope you can understand why now.

Cheers

Tom

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] ProxyPass work correctly but ReWriteRule has some error

Posted by Tapas Mishra <mi...@gmail.com>.
> Really? You can't see what's wrong there?
Yes I am not clear with ReWriteRule.

> Your rewrite rule says to look for the URLs beginning with '/olat/'
> and you went to '/olat'.
That is how olat works
when some one types in browser
http://mydomain.com/olat

then they get a page
http://mydomain.com/olat/index.php
or some other pages I do not know what exactly has been programmed in
OLAT (I downloaded it from internet)

> You shouldn't be using rewrite to initiate proxying unless your

> situation is strange or bizarre -

>and if you have control over your
> situation, don't make it strange or bizarre.
I am trying to understand how where can ReWriteRule be used and where
ProxyPass is used.

So I want to know what is the mistake.


-- 
Tapas
http://mightydreams.blogspot.com
http://wiki.xensource.com/xenwiki/Xen_on_4_app_servers

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org