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/01 22:36:02 UTC

[users@httpd] mod_rewrite issue

Hi friends!

I have an aplication hosted on a JBOSS server that must receive an id
as argument.
This id will make the application load the correct template for the typed URL.

Eg.: For URL 'client1.app.mydomain.com', the application will load the
template for 'client1'.

I trying to do something like this:

<VirtualHost *:80>
    ServerName www.app.mydomain.com
    ServerAlias *.app.mydomain.com

    RewriteCond %{http_host} ^(.*).app.mydomain.com
    RewriteRule ^(.*) http://localhost:8080/app?id=%1 [P,L]
</VirtualHost>

The problem is that I get a redirect to
'http://localhost:5050/app?id=client1' and I want to keep the original
URL (client1.app.mydomain.com).

 Do you have another idea in how to do this functional ?

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] mod_rewrite issue

Posted by Joshua Slive <jo...@slive.ca>.
On 8/1/06, SOPRO <so...@gmail.com> wrote:
> Hi friends!
>
> I have an aplication hosted on a JBOSS server that must receive an id
> as argument.
> This id will make the application load the correct template for the typed URL.
>
> Eg.: For URL 'client1.app.mydomain.com', the application will load the
> template for 'client1'.
>
> I trying to do something like this:
>
> <VirtualHost *:80>
>     ServerName www.app.mydomain.com
>     ServerAlias *.app.mydomain.com
>
>     RewriteCond %{http_host} ^(.*).app.mydomain.com
>     RewriteRule ^(.*) http://localhost:8080/app?id=%1 [P,L]
> </VirtualHost>
>
> The problem is that I get a redirect to
> 'http://localhost:5050/app?id=client1' and I want to keep the original
> URL (client1.app.mydomain.com).

What does the RewriteLog say when you configure it?  Do you have
mod_proxy and mod_proxy_http included in the server?  Are you sure it
is not the app server sending the redirect?  (Have you done a packet
trace?)

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] mod_rewrite issue

Posted by SOPRO <so...@gmail.com>.
Hi Krist,

 As you sugested, I used LiveHTTPHeaders plugin and I got this:

----------------------------------------------------------
http://client1.app.mydomain.com/

GET / HTTP/1.1
Host: client1.app.mydomain.com
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.0.6)
Gecko/20060728 Firefox/1.5.0.6
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Accept-Language: pt-br,en-us;q=0.7,en;q=0.3
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive

HTTP/1.x 302 Moved Temporarily
Date: Fri, 04 Aug 2006 14:37:34 GMT
Server: Apache-Coyote/1.1
Vary: Host
Location: http://localhost:5050/b2b/?id=client1
X-Cache: MISS from www.app.mydomain.com
Keep-Alive: timeout=15, max=100
Connection: Keep-Alive
Transfer-Encoding: chunked
Content-Type: text/plain
----------------------------------------------------------

 Can you help me to understand it ? :-)

Thanks!

Fabricio.



2006/8/2, Krist van Besien <kr...@gmail.com>:
> On 8/1/06, SOPRO <so...@gmail.com> wrote:
> > Hi friends!
> >
> > I have an aplication hosted on a JBOSS server that must receive an id
> > as argument.
> > This id will make the application load the correct template for the typed URL.
> >
> > Eg.: For URL 'client1.app.mydomain.com', the application will load the
> > template for 'client1'.
> >
> > I trying to do something like this:
> >
> > <VirtualHost *:80>
> >     ServerName www.app.mydomain.com
> >     ServerAlias *.app.mydomain.com
> >
> >     RewriteCond %{http_host} ^(.*).app.mydomain.com
> >     RewriteRule ^(.*) http://localhost:8080/app?id=%1 [P,L]
> > </VirtualHost>
> >
> > The problem is that I get a redirect to
> > 'http://localhost:5050/app?id=client1' and I want to keep the original
> > URL (client1.app.mydomain.com).
> >
> >  Do you have another idea in how to do this functional ?
>
> Your problem might be that the JBOSS server sends a redirect. Use a
> tool like the LiveHTTPHeaders plugin in Firefox to see what the server
> communicates back to the browser.
>
> Krist
>
>
>
> --
> krist.vanbesien@gmail.com
> Bremgarten b. Bern, Switzerland
>
> ---------------------------------------------------------------------
> 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] mod_rewrite issue

Posted by Krist van Besien <kr...@gmail.com>.
On 8/1/06, SOPRO <so...@gmail.com> wrote:
> Hi friends!
>
> I have an aplication hosted on a JBOSS server that must receive an id
> as argument.
> This id will make the application load the correct template for the typed URL.
>
> Eg.: For URL 'client1.app.mydomain.com', the application will load the
> template for 'client1'.
>
> I trying to do something like this:
>
> <VirtualHost *:80>
>     ServerName www.app.mydomain.com
>     ServerAlias *.app.mydomain.com
>
>     RewriteCond %{http_host} ^(.*).app.mydomain.com
>     RewriteRule ^(.*) http://localhost:8080/app?id=%1 [P,L]
> </VirtualHost>
>
> The problem is that I get a redirect to
> 'http://localhost:5050/app?id=client1' and I want to keep the original
> URL (client1.app.mydomain.com).
>
>  Do you have another idea in how to do this functional ?

Your problem might be that the JBOSS server sends a redirect. Use a
tool like the LiveHTTPHeaders plugin in Firefox to see what the server
communicates back to the browser.

Krist



-- 
krist.vanbesien@gmail.com
Bremgarten b. Bern, Switzerland

---------------------------------------------------------------------
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