You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by SOPRO <so...@gmail.com> on 2006/08/07 19:31:01 UTC
[users@httpd] Rewrite - Almost there !
Hi friends,
I'm trying to write a rule, that takes the client id and pass to an
application hosted on a jboss server.
<VirtualHost *:443>
ServerName server.mydomain.com
RewriteEngine On
RewriteLog "/var/log/apache/rewrite-ssl.log"
RewriteLogLevel 3
RewriteCond %{REQUEST_URI} ^/app/.*
RewriteRule ^/(.*)/([^/]+)$ http://localhost:5050/app/index.jsp?id=$2 [P]
</VirtualHost>
When I type 'server.mydomain.com/app/client1', the rule sends this to
my jboss sever:
http://localhost:5050/app/index.jsp?id=client1
The problem is that it was sending these requests too:
http://localhost:5050/app/index.jsp?id=stylesheet.css
http://localhost:5050/app/index.jsp?id=logo_client1.png
How can I make it stops in the first rewrite (id=client1) ?
ps.: I'm using Apache 1.3.37 and JBoss (Tomcat) 4.0.3SP1.
Thanks!
Fabricio.
---------------------------------------------------------------------
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] Rewrite - Almost there !
Posted by SOPRO <so...@gmail.com>.
Joshua,
It works very fine ! :-)
I'm so grateful !
Finally, my config is working:
---- begin ----
RewriteCond %{REQUEST_URI} ^/app/.*
RewriteCond %{REQUEST_URI} !\.
RewriteRule ^/(.*)/([^/]+)$ http://localhost:5050/app/index.jsp?id=$2 [P,L]
RewriteRule ^/app/(.*) http://localhost:5050/app/$1 [P]
---- end ----
Regards,
Fabricio.
2006/8/7, Joshua Slive <jo...@slive.ca>:
> On 8/7/06, SOPRO <so...@gmail.com> wrote:
> > Joshua,
> >
> > Thanks so much !
> > I used the option "!\." and it works ... :-)
> > However, the files 'stylesheet.css' and 'logo_client1.png' have not
> > been loaded properly.
> > Do you have any idea ?
> >
> > ps.: If I access JBOSS directly, the stylesheet and images are loaded fine.
>
> Sorry, I assumed that these files were hosted by apache, not jboss.
> If they are hosted by jboss, you need to also change [P] to [P,L] and
> add something like
> RewriteRule ^/app/(.*) http://localhost:5050/app/$1 [P]
>
> Joshua.
>
> ---------------------------------------------------------------------
> 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
>
>
---------------------------------------------------------------------
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] Rewrite - Almost there !
Posted by Joshua Slive <jo...@slive.ca>.
On 8/7/06, SOPRO <so...@gmail.com> wrote:
> Joshua,
>
> Thanks so much !
> I used the option "!\." and it works ... :-)
> However, the files 'stylesheet.css' and 'logo_client1.png' have not
> been loaded properly.
> Do you have any idea ?
>
> ps.: If I access JBOSS directly, the stylesheet and images are loaded fine.
Sorry, I assumed that these files were hosted by apache, not jboss.
If they are hosted by jboss, you need to also change [P] to [P,L] and
add something like
RewriteRule ^/app/(.*) http://localhost:5050/app/$1 [P]
Joshua.
---------------------------------------------------------------------
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] Rewrite - Almost there !
Posted by SOPRO <so...@gmail.com>.
Joshua,
Thanks so much !
I used the option "!\." and it works ... :-)
However, the files 'stylesheet.css' and 'logo_client1.png' have not
been loaded properly.
Do you have any idea ?
ps.: If I access JBOSS directly, the stylesheet and images are loaded fine.
Thanks!
Fabricio.
2006/8/7, Joshua Slive <jo...@slive.ca>:
> On 8/7/06, SOPRO <so...@gmail.com> wrote:
> > Hi friends,
> >
> > I'm trying to write a rule, that takes the client id and pass to an
> > application hosted on a jboss server.
> >
> > <VirtualHost *:443>
> > ServerName server.mydomain.com
> > RewriteEngine On
> > RewriteLog "/var/log/apache/rewrite-ssl.log"
> > RewriteLogLevel 3
> >
> > RewriteCond %{REQUEST_URI} ^/app/.*
> > RewriteRule ^/(.*)/([^/]+)$ http://localhost:5050/app/index.jsp?id=$2 [P]
> > </VirtualHost>
> >
> > When I type 'server.mydomain.com/app/client1', the rule sends this to
> > my jboss sever:
> >
> > http://localhost:5050/app/index.jsp?id=client1
> >
> > The problem is that it was sending these requests too:
> >
> > http://localhost:5050/app/index.jsp?id=stylesheet.css
> > http://localhost:5050/app/index.jsp?id=logo_client1.png
> >
> > How can I make it stops in the first rewrite (id=client1) ?
>
> Each request is an entirely separate entity to apache httpd. So you
> need to find a way to differentiate the requests you wnat forwarded
> from the requests you want served locally.
>
> For example, you could add the following:
> RewriteCond %{Request_URI} !.*\.(css|png)
> or if you are sure that the clientid never contains a period, simply:
> RewriteCond %{Request_URI} !\.
>
> Joshua.
>
> ---------------------------------------------------------------------
> 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
>
>
---------------------------------------------------------------------
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] Rewrite - Almost there !
Posted by Joshua Slive <jo...@slive.ca>.
On 8/7/06, SOPRO <so...@gmail.com> wrote:
> Hi friends,
>
> I'm trying to write a rule, that takes the client id and pass to an
> application hosted on a jboss server.
>
> <VirtualHost *:443>
> ServerName server.mydomain.com
> RewriteEngine On
> RewriteLog "/var/log/apache/rewrite-ssl.log"
> RewriteLogLevel 3
>
> RewriteCond %{REQUEST_URI} ^/app/.*
> RewriteRule ^/(.*)/([^/]+)$ http://localhost:5050/app/index.jsp?id=$2 [P]
> </VirtualHost>
>
> When I type 'server.mydomain.com/app/client1', the rule sends this to
> my jboss sever:
>
> http://localhost:5050/app/index.jsp?id=client1
>
> The problem is that it was sending these requests too:
>
> http://localhost:5050/app/index.jsp?id=stylesheet.css
> http://localhost:5050/app/index.jsp?id=logo_client1.png
>
> How can I make it stops in the first rewrite (id=client1) ?
Each request is an entirely separate entity to apache httpd. So you
need to find a way to differentiate the requests you wnat forwarded
from the requests you want served locally.
For example, you could add the following:
RewriteCond %{Request_URI} !.*\.(css|png)
or if you are sure that the clientid never contains a period, simply:
RewriteCond %{Request_URI} !\.
Joshua.
---------------------------------------------------------------------
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