You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Robert Bourdeau <bo...@ciesin.columbia.edu> on 2002/06/18 17:46:29 UTC

URL rewriting solution in FAQ does not do the trick

This is more of an Apache question than a Cocoon question, but
hopefully someone will know what I'm doing wrong here.

Setup: SPARC Solaris 2.7, Apache 1.3.24 w/mod_webapp (Warp), and Tomcat 4.0.1

Goal:  Eliminate cocoon from the URL
Constraints:  Want all my custom content (XML, stylesheets, etc.) to be removed
from the Cocoon tree so I can upgrade Cocoon separately. Must use Apache to
receive request. URL mapping has to be done per virtual host.

I looked at the FAQ, and followed the instructions. I rebuilt Apache with mod_rewrite
enabled, then added the followed code to my httpd.conf:

<VirtualHost 	myhost.mydomain:80>
    ServerName	      myhost.mydomain
    DocumentRoot       /myhost.mydomain/htmls

    <IfModule mod_rewrite.c>
        RewriteEngine on
        RewriteLog /var/adm/www/rewrite.log
        RewriteLogLevel 9
        RewriteRule ^/xml /cocoon/xml/ [R]
        RewriteRule ^/xml(.*) /cocoon/xml$1 [R]
    </IfModule>

    WebAppConnection   conn      warp    myhost.mydomain:8008
    WebAppDeploy       cocoon    conn    /cocoon
</VirtualHost>

I also modified the Cocoon sitemap.xmap to forward the processing to a sitemap
outside of the Cocoon tree.

This URL works:

http://myhost.mydomain/cocoon/xml/foo
	* Apache correctly passes the /cocoon/xml/foo address to 
        Tomcat which then passes it to Cocoon. Output is correct

This URL 
                 http://myhost.mydomain/xml/foo
is redirected to http://myhost.mydomain/cocoon/xml/foo
and the user sees it in the browser. Not what I wanted.
I tried the single line [PT] variation shown in the FAQ, and 
as indicated there, this does not work at all.

Thoughts?

Regards,
--- Bob Bourdeau

---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>


Re: URL rewriting solution in FAQ does not do the trick

Posted by Lajos Moczar <lm...@galatea.com>.
True, you are building stuff right out of the box and don't want to make 
configuration changes that might be overwritten when you reinstall or 
upgrade components. However, for production purposes, the Tomcat home 
and docs pages are oftentimes superfluous (just like Cocoon examples, 
Apache docs, etc.). At least I find them sperfluous, as do many of my 
clients. Hence, I typically strip off all included webapps, and make 
cocoon the ROOT context.

Regards,

Lajos


Luca Morandini wrote:

> Lajos,
> 
> OTOH, the adding of this context will make the Tomcat doc and Tomcat home
> page unreacheable.
> 
> There are ways around it (like the adding of /root and /tomcat-docs
> contexts),
> but replacing the default Tomcat behaviour doesn't seem to me such a good
> idea; though, it may be just fine for a production environment.
> 
> In my opinion the use of mod_rewrite, ugly as it may be, is still the path
> of least resistance (it doesn't alter the behaviour of anything).
> 
> Best regards,
> 
> ---------------------------------------------
>                Luca Morandini
>                GIS Consultant
>               lmorandini@ieee.org
> http://utenti.tripod.it/lmorandini/index.html
> ---------------------------------------------
> 
> 
> 
>>-----Original Message-----
>>From: Lajos Moczar [mailto:lmocz@galatea.com]
>>Sent: Tuesday, June 18, 2002 5:57 PM
>>To: cocoon-users@xml.apache.org
>>Subject: Re: URL rewriting solution in FAQ does not do the trick
>>
>>
>>Why not do this in $CATALINA_HOME/conf/server.xml:
>>
>><Context path="" docBase="cocoon"
>>  debug="0" reloadable="true"/>
>>
>>Regards,
>>
>>Lajos
>>
>>
>>Robert Bourdeau wrote:
>>
>>
>>>This is more of an Apache question than a Cocoon question, but
>>>hopefully someone will know what I'm doing wrong here.
>>>
>>>Setup: SPARC Solaris 2.7, Apache 1.3.24 w/mod_webapp (Warp),
>>>
>>and Tomcat 4.0.1
>>
>>>Goal:  Eliminate cocoon from the URL
>>>Constraints:  Want all my custom content (XML, stylesheets,
>>>
>>etc.) to be removed
>>
>>>from the Cocoon tree so I can upgrade Cocoon separately. Must
>>>
>>use Apache to
>>
>>>receive request. URL mapping has to be done per virtual host.
>>>
>>>I looked at the FAQ, and followed the instructions. I rebuilt
>>>
>>Apache with mod_rewrite
>>
>>>enabled, then added the followed code to my httpd.conf:
>>>
>>><VirtualHost 	myhost.mydomain:80>
>>>    ServerName	      myhost.mydomain
>>>    DocumentRoot       /myhost.mydomain/htmls
>>>
>>>    <IfModule mod_rewrite.c>
>>>        RewriteEngine on
>>>        RewriteLog /var/adm/www/rewrite.log
>>>        RewriteLogLevel 9
>>>        RewriteRule ^/xml /cocoon/xml/ [R]
>>>        RewriteRule ^/xml(.*) /cocoon/xml$1 [R]
>>>    </IfModule>
>>>
>>>    WebAppConnection   conn      warp    myhost.mydomain:8008
>>>    WebAppDeploy       cocoon    conn    /cocoon
>>></VirtualHost>
>>>
>>>I also modified the Cocoon sitemap.xmap to forward the
>>>
>>processing to a sitemap
>>
>>>outside of the Cocoon tree.
>>>
>>>This URL works:
>>>
>>>http://myhost.mydomain/cocoon/xml/foo
>>>	* Apache correctly passes the /cocoon/xml/foo address to
>>>        Tomcat which then passes it to Cocoon. Output is correct
>>>
>>>This URL
>>>                 http://myhost.mydomain/xml/foo
>>>is redirected to http://myhost.mydomain/cocoon/xml/foo
>>>and the user sees it in the browser. Not what I wanted.
>>>I tried the single line [PT] variation shown in the FAQ, and
>>>as indicated there, this does not work at all.
>>>
>>>Thoughts?
>>>
>>>Regards,
>>>--- Bob Bourdeau
>>>
>>>---------------------------------------------------------------------
>>>Please check that your question  has not already been answered in the
>>>FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>
>>>
>>>To unsubscribe, e-mail:     <co...@xml.apache.org>
>>>For additional commands, e-mail:   <co...@xml.apache.org>
>>>
>>>
>>
>>--
>>
>>Cocoon training, consulting & support
>>galatea.com
>>
>>
>>
>>---------------------------------------------------------------------
>>Please check that your question  has not already been answered in the
>>FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>
>>
>>To unsubscribe, e-mail:     <co...@xml.apache.org>
>>For additional commands, e-mail:   <co...@xml.apache.org>
>>
> 
> 
> ---------------------------------------------------------------------
> Please check that your question  has not already been answered in the
> FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>
> 
> To unsubscribe, e-mail:     <co...@xml.apache.org>
> For additional commands, e-mail:   <co...@xml.apache.org>
> 
> 


-- 
galatea.com
Cocoon training, consulting & support



---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>


RE: URL rewriting solution in FAQ does not do the trick

Posted by Vadim Gritsenko <va...@verizon.net>.
> From: Luca Morandini [mailto:luca.morandini1@tin.it]
> 
> Lajos,
> 
> OTOH, the adding of this context will make the Tomcat doc and Tomcat
home
> page unreacheable.

$TOMCAT_HOME/bin/shutdown
cd $TOMCAT_HOME/webapps
mv ROOT tomcat
mv cocoon ROOT
$TOMCAT_HOME/bin/startup

:)


> There are ways around it (like the adding of /root and /tomcat-docs
> contexts),
> but replacing the default Tomcat behaviour doesn't seem to me such a
good
> idea; though, it may be just fine for a production environment.

This context (ROOT) is == to the Apache's famous "This host has Apache
HTTP server installed, and does not have own web site developed yet.
Please do not write Apache about this happy guy who managed to install
Apache HTTP server" and must be removed as soon as solution goes to QA,
or even way before this.

:)


> In my opinion the use of mod_rewrite, ugly as it may be, is still the
path

+1. It is ugly.


> of least resistance (it doesn't alter the behaviour of anything).

-1. Why keep ugly and less performing solution while others exist?

Vadim


> Best regards,
> 
> ---------------------------------------------
>                Luca Morandini
>                GIS Consultant
>               lmorandini@ieee.org
> http://utenti.tripod.it/lmorandini/index.html
> ---------------------------------------------
> 
> 
> > -----Original Message-----
> > From: Lajos Moczar [mailto:lmocz@galatea.com]
> > Sent: Tuesday, June 18, 2002 5:57 PM
> > To: cocoon-users@xml.apache.org
> > Subject: Re: URL rewriting solution in FAQ does not do the trick
> >
> >
> > Why not do this in $CATALINA_HOME/conf/server.xml:
> >
> > <Context path="" docBase="cocoon"
> >   debug="0" reloadable="true"/>
> >
> > Regards,
> >
> > Lajos
> >
> >
> > Robert Bourdeau wrote:
> >
> > > This is more of an Apache question than a Cocoon question, but
> > > hopefully someone will know what I'm doing wrong here.
> > >
> > > Setup: SPARC Solaris 2.7, Apache 1.3.24 w/mod_webapp (Warp),
> > and Tomcat 4.0.1
> > >
> > > Goal:  Eliminate cocoon from the URL
> > > Constraints:  Want all my custom content (XML, stylesheets,
> > etc.) to be removed
> > > from the Cocoon tree so I can upgrade Cocoon separately. Must
> > use Apache to
> > > receive request. URL mapping has to be done per virtual host.
> > >
> > > I looked at the FAQ, and followed the instructions. I rebuilt
> > Apache with mod_rewrite
> > > enabled, then added the followed code to my httpd.conf:
> > >
> > > <VirtualHost 	myhost.mydomain:80>
> > >     ServerName	      myhost.mydomain
> > >     DocumentRoot       /myhost.mydomain/htmls
> > >
> > >     <IfModule mod_rewrite.c>
> > >         RewriteEngine on
> > >         RewriteLog /var/adm/www/rewrite.log
> > >         RewriteLogLevel 9
> > >         RewriteRule ^/xml /cocoon/xml/ [R]
> > >         RewriteRule ^/xml(.*) /cocoon/xml$1 [R]
> > >     </IfModule>
> > >
> > >     WebAppConnection   conn      warp    myhost.mydomain:8008
> > >     WebAppDeploy       cocoon    conn    /cocoon
> > > </VirtualHost>
> > >
> > > I also modified the Cocoon sitemap.xmap to forward the
> > processing to a sitemap
> > > outside of the Cocoon tree.
> > >
> > > This URL works:
> > >
> > > http://myhost.mydomain/cocoon/xml/foo
> > > 	* Apache correctly passes the /cocoon/xml/foo address to
> > >         Tomcat which then passes it to Cocoon. Output is correct
> > >
> > > This URL
> > >                  http://myhost.mydomain/xml/foo
> > > is redirected to http://myhost.mydomain/cocoon/xml/foo
> > > and the user sees it in the browser. Not what I wanted.
> > > I tried the single line [PT] variation shown in the FAQ, and
> > > as indicated there, this does not work at all.
> > >
> > > Thoughts?
> > >
> > > Regards,
> > > --- Bob Bourdeau
> >
> > --
> >
> > Cocoon training, consulting & support
> > galatea.com


---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>


RE: URL rewriting solution in FAQ does not do the trick

Posted by Luca Morandini <lu...@tin.it>.
Lajos,

OTOH, the adding of this context will make the Tomcat doc and Tomcat home
page unreacheable.

There are ways around it (like the adding of /root and /tomcat-docs
contexts),
but replacing the default Tomcat behaviour doesn't seem to me such a good
idea; though, it may be just fine for a production environment.

In my opinion the use of mod_rewrite, ugly as it may be, is still the path
of least resistance (it doesn't alter the behaviour of anything).

Best regards,

---------------------------------------------
               Luca Morandini
               GIS Consultant
              lmorandini@ieee.org
http://utenti.tripod.it/lmorandini/index.html
---------------------------------------------


> -----Original Message-----
> From: Lajos Moczar [mailto:lmocz@galatea.com]
> Sent: Tuesday, June 18, 2002 5:57 PM
> To: cocoon-users@xml.apache.org
> Subject: Re: URL rewriting solution in FAQ does not do the trick
>
>
> Why not do this in $CATALINA_HOME/conf/server.xml:
>
> <Context path="" docBase="cocoon"
>   debug="0" reloadable="true"/>
>
> Regards,
>
> Lajos
>
>
> Robert Bourdeau wrote:
>
> > This is more of an Apache question than a Cocoon question, but
> > hopefully someone will know what I'm doing wrong here.
> >
> > Setup: SPARC Solaris 2.7, Apache 1.3.24 w/mod_webapp (Warp),
> and Tomcat 4.0.1
> >
> > Goal:  Eliminate cocoon from the URL
> > Constraints:  Want all my custom content (XML, stylesheets,
> etc.) to be removed
> > from the Cocoon tree so I can upgrade Cocoon separately. Must
> use Apache to
> > receive request. URL mapping has to be done per virtual host.
> >
> > I looked at the FAQ, and followed the instructions. I rebuilt
> Apache with mod_rewrite
> > enabled, then added the followed code to my httpd.conf:
> >
> > <VirtualHost 	myhost.mydomain:80>
> >     ServerName	      myhost.mydomain
> >     DocumentRoot       /myhost.mydomain/htmls
> >
> >     <IfModule mod_rewrite.c>
> >         RewriteEngine on
> >         RewriteLog /var/adm/www/rewrite.log
> >         RewriteLogLevel 9
> >         RewriteRule ^/xml /cocoon/xml/ [R]
> >         RewriteRule ^/xml(.*) /cocoon/xml$1 [R]
> >     </IfModule>
> >
> >     WebAppConnection   conn      warp    myhost.mydomain:8008
> >     WebAppDeploy       cocoon    conn    /cocoon
> > </VirtualHost>
> >
> > I also modified the Cocoon sitemap.xmap to forward the
> processing to a sitemap
> > outside of the Cocoon tree.
> >
> > This URL works:
> >
> > http://myhost.mydomain/cocoon/xml/foo
> > 	* Apache correctly passes the /cocoon/xml/foo address to
> >         Tomcat which then passes it to Cocoon. Output is correct
> >
> > This URL
> >                  http://myhost.mydomain/xml/foo
> > is redirected to http://myhost.mydomain/cocoon/xml/foo
> > and the user sees it in the browser. Not what I wanted.
> > I tried the single line [PT] variation shown in the FAQ, and
> > as indicated there, this does not work at all.
> >
> > Thoughts?
> >
> > Regards,
> > --- Bob Bourdeau
> >
> > ---------------------------------------------------------------------
> > Please check that your question  has not already been answered in the
> > FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>
> >
> > To unsubscribe, e-mail:     <co...@xml.apache.org>
> > For additional commands, e-mail:   <co...@xml.apache.org>
> >
> >
>
>
> --
>
> Cocoon training, consulting & support
> galatea.com
>
>
>
> ---------------------------------------------------------------------
> Please check that your question  has not already been answered in the
> FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>
>
> To unsubscribe, e-mail:     <co...@xml.apache.org>
> For additional commands, e-mail:   <co...@xml.apache.org>
>


---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>


Re: URL rewriting solution in FAQ does not do the trick

Posted by Lajos Moczar <lm...@galatea.com>.
Why not do this in $CATALINA_HOME/conf/server.xml:

<Context path="" docBase="cocoon"
  debug="0" reloadable="true"/>

Regards,

Lajos


Robert Bourdeau wrote:

> This is more of an Apache question than a Cocoon question, but
> hopefully someone will know what I'm doing wrong here.
> 
> Setup: SPARC Solaris 2.7, Apache 1.3.24 w/mod_webapp (Warp), and Tomcat 4.0.1
> 
> Goal:  Eliminate cocoon from the URL
> Constraints:  Want all my custom content (XML, stylesheets, etc.) to be removed
> from the Cocoon tree so I can upgrade Cocoon separately. Must use Apache to
> receive request. URL mapping has to be done per virtual host.
> 
> I looked at the FAQ, and followed the instructions. I rebuilt Apache with mod_rewrite
> enabled, then added the followed code to my httpd.conf:
> 
> <VirtualHost 	myhost.mydomain:80>
>     ServerName	      myhost.mydomain
>     DocumentRoot       /myhost.mydomain/htmls
> 
>     <IfModule mod_rewrite.c>
>         RewriteEngine on
>         RewriteLog /var/adm/www/rewrite.log
>         RewriteLogLevel 9
>         RewriteRule ^/xml /cocoon/xml/ [R]
>         RewriteRule ^/xml(.*) /cocoon/xml$1 [R]
>     </IfModule>
> 
>     WebAppConnection   conn      warp    myhost.mydomain:8008
>     WebAppDeploy       cocoon    conn    /cocoon
> </VirtualHost>
> 
> I also modified the Cocoon sitemap.xmap to forward the processing to a sitemap
> outside of the Cocoon tree.
> 
> This URL works:
> 
> http://myhost.mydomain/cocoon/xml/foo
> 	* Apache correctly passes the /cocoon/xml/foo address to 
>         Tomcat which then passes it to Cocoon. Output is correct
> 
> This URL 
>                  http://myhost.mydomain/xml/foo
> is redirected to http://myhost.mydomain/cocoon/xml/foo
> and the user sees it in the browser. Not what I wanted.
> I tried the single line [PT] variation shown in the FAQ, and 
> as indicated there, this does not work at all.
> 
> Thoughts?
> 
> Regards,
> --- Bob Bourdeau
> 
> ---------------------------------------------------------------------
> Please check that your question  has not already been answered in the
> FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>
> 
> To unsubscribe, e-mail:     <co...@xml.apache.org>
> For additional commands, e-mail:   <co...@xml.apache.org>
> 
> 


-- 

Cocoon training, consulting & support
galatea.com



---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>