You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Derek Hohls <DH...@csir.co.za> on 2005/01/19 10:43:42 UTC

Cocoon with Virtual Hosts (apache/tomcat)

I am working with Apache/Tomcat and Cocoon 2.1.5. 
I am trying to have a virtual host setup, so users from
outside the organisation can access the site.


In the Apache httpd.conf file, the Unix admin has inserted
(note that I have changed some actual parameters for security...)
the following (NB: I have been told that the warp connnector
option *cannot* be setup... we need to use a proxy rewrite)

<VirtualHost 0.0.0.0>
ServerAdmin me@here.com 
ServerName soc.myserver.com:80
DocumentRoot /usr/local/tomcat/webapps

RewriteEngine   on
# If URL has cocoon215/soc(/) we don't rewrite, therefore Last rule
RewriteRule ^/cocoon215/soc/(.*)      /cocoon215/soc/$1 [R,L]
RewriteRule ^/cocoon215/soc$         /cocoon215/soc [R,L]
# Else we must rewrite
#RewriteRule ^/$        /cocoon215/soc [R,L]
RewriteRule ^/(.*)        /cocoon215/soc/$1 [R,L]
# We reverse proxy instead of Warp connector 
ProxyPass /cocoon215/soc http://localhost:8080/cocoon215/soc 
ProxyPassReverse /cocoon215/soc http://localhost:8080/cocoon215/soc 
</VirtualHost>


In my sitemap I have:

<map:match pattern="pageTest">
  <map:generate src="docs/test.xml"/>
  <map:transform src="stylesheets/doc/test-page2html.xsl">
   <map:parameter name="use-request-parameters" value="true"/>
   <map:parameter name="contextPath" value="{request:contextPath}"/>
   <map:parameter name="servletPath" value="{request:servletPath}"/>
   <map:parameter name="serverName" value="{request:serverName}"/>
   <map:parameter name="serverPort" value="{request:serverPort}"/>    

  </map:transform>    
  <map:serialize/>      
</map:match> 


In the stylesheet (test-page2html.xsl) I have:

<xsl:param name="contextPath"/>
<xsl:param name="servletPath"/>
<xsl:param name="serverName"/>
<xsl:param name="serverPort"/>
...
<p>Context=<xsl:value-of select="$contextPath"/></p>
<p>Servlet=<xsl:value-of select="$servletPath"/></p>
<p>Server=<xsl:value-of select="$serverName"/></p>
<p>Port=<xsl:value-of select="$serverPort"/></p>


But, whether I try 
http://myserver.com:8080/cocoon215/soc/pageTest 
or
http://soc.myserver.com/cocoon215/soc/pageTest 

I have the same results:

Context=/cocoon215
Servlet=/soc/pageTest
Server=myserver.com
Port=8080


In order for the application to work properly, 
what do I need to do to get to this:

Context=/cocoon215
Servlet=/soc/pageTest
Server=soc.myserver.com
Port=[null]

Any ideas how?

Thanks
Derek



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: Cocoon with Virtual Hosts (apache/tomcat)

Posted by Upayavira <uv...@upaya.co.uk>.
Derek Hohls wrote:

>I am working with Apache/Tomcat and Cocoon 2.1.5. 
>I am trying to have a virtual host setup, so users from
>outside the organisation can access the site.
>
>
>In the Apache httpd.conf file, the Unix admin has inserted
>(note that I have changed some actual parameters for security...)
>the following (NB: I have been told that the warp connnector
>option *cannot* be setup... we need to use a proxy rewrite)
>
><VirtualHost 0.0.0.0>
>ServerAdmin me@here.com 
>ServerName soc.myserver.com:80
>DocumentRoot /usr/local/tomcat/webapps
>
>RewriteEngine   on
># If URL has cocoon215/soc(/) we don't rewrite, therefore Last rule
>RewriteRule ^/cocoon215/soc/(.*)      /cocoon215/soc/$1 [R,L]
>RewriteRule ^/cocoon215/soc$         /cocoon215/soc [R,L]
># Else we must rewrite
>#RewriteRule ^/$        /cocoon215/soc [R,L]
>RewriteRule ^/(.*)        /cocoon215/soc/$1 [R,L]
># We reverse proxy instead of Warp connector 
>ProxyPass /cocoon215/soc http://localhost:8080/cocoon215/soc 
>ProxyPassReverse /cocoon215/soc http://localhost:8080/cocoon215/soc 
></VirtualHost>
>
>
>In my sitemap I have:
>
><map:match pattern="pageTest">
>  <map:generate src="docs/test.xml"/>
>  <map:transform src="stylesheets/doc/test-page2html.xsl">
>   <map:parameter name="use-request-parameters" value="true"/>
>   <map:parameter name="contextPath" value="{request:contextPath}"/>
>   <map:parameter name="servletPath" value="{request:servletPath}"/>
>   <map:parameter name="serverName" value="{request:serverName}"/>
>   <map:parameter name="serverPort" value="{request:serverPort}"/>    
>
>  </map:transform>    
>  <map:serialize/>      
></map:match> 
>
>
>In the stylesheet (test-page2html.xsl) I have:
>
><xsl:param name="contextPath"/>
><xsl:param name="servletPath"/>
><xsl:param name="serverName"/>
><xsl:param name="serverPort"/>
>...
><p>Context=<xsl:value-of select="$contextPath"/></p>
><p>Servlet=<xsl:value-of select="$servletPath"/></p>
><p>Server=<xsl:value-of select="$serverName"/></p>
><p>Port=<xsl:value-of select="$serverPort"/></p>
>
>
>But, whether I try 
>http://myserver.com:8080/cocoon215/soc/pageTest 
>or
>http://soc.myserver.com/cocoon215/soc/pageTest 
>
>I have the same results:
>
>Context=/cocoon215
>Servlet=/soc/pageTest
>Server=myserver.com
>Port=8080
>
>
>In order for the application to work properly, 
>what do I need to do to get to this:
>
>Context=/cocoon215
>Servlet=/soc/pageTest
>Server=soc.myserver.com
>Port=[null]
>
>Any ideas how?
>  
>
Cocoon will see the hostname as being the one supplied from Apache. You 
have:

ProxyPass /cocoon215/soc http://localhost:8080/cocoon215/soc 
ProxyPassReverse /cocoon215/soc http://localhost:8080/cocoon215/soc 

So Cocoon should see localhost. You could replace this with soc.myserver.com. If that points to an external IP address, add:
127.0.0.1  soc.myserver.com
to your /etc/hosts file.

Make sense?

Regards, Upayavira




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: Cocoon with Virtual Hosts (apache/tomcat)

Posted by Nouguier Olivier <ol...@wanadoo.fr>.
hi
And what about mod_jk2?
 http://jakarta.apache.org/tomcat/connectors-doc/index.html

On Wed, 2005-01-19 at 11:43 +0200, Derek Hohls wrote:
> I am working with Apache/Tomcat and Cocoon 2.1.5. 
> I am trying to have a virtual host setup, so users from
> outside the organisation can access the site.
> 
> 
> In the Apache httpd.conf file, the Unix admin has inserted
> (note that I have changed some actual parameters for security...)
> the following (NB: I have been told that the warp connnector
> option *cannot* be setup... we need to use a proxy rewrite)
> 
> <VirtualHost 0.0.0.0>
> ServerAdmin me@here.com 
> ServerName soc.myserver.com:80
> DocumentRoot /usr/local/tomcat/webapps
> 
> RewriteEngine   on
> # If URL has cocoon215/soc(/) we don't rewrite, therefore Last rule
> RewriteRule ^/cocoon215/soc/(.*)      /cocoon215/soc/$1 [R,L]
> RewriteRule ^/cocoon215/soc$         /cocoon215/soc [R,L]
> # Else we must rewrite
> #RewriteRule ^/$        /cocoon215/soc [R,L]
> RewriteRule ^/(.*)        /cocoon215/soc/$1 [R,L]
> # We reverse proxy instead of Warp connector 
> ProxyPass /cocoon215/soc http://localhost:8080/cocoon215/soc 
> ProxyPassReverse /cocoon215/soc http://localhost:8080/cocoon215/soc 
> </VirtualHost>
> 
> 
> In my sitemap I have:
> 
> <map:match pattern="pageTest">
>   <map:generate src="docs/test.xml"/>
>   <map:transform src="stylesheets/doc/test-page2html.xsl">
>    <map:parameter name="use-request-parameters" value="true"/>
>    <map:parameter name="contextPath" value="{request:contextPath}"/>
>    <map:parameter name="servletPath" value="{request:servletPath}"/>
>    <map:parameter name="serverName" value="{request:serverName}"/>
>    <map:parameter name="serverPort" value="{request:serverPort}"/>    
> 
>   </map:transform>    
>   <map:serialize/>      
> </map:match> 
> 
> 
> In the stylesheet (test-page2html.xsl) I have:
> 
> <xsl:param name="contextPath"/>
> <xsl:param name="servletPath"/>
> <xsl:param name="serverName"/>
> <xsl:param name="serverPort"/>
> ...
> <p>Context=<xsl:value-of select="$contextPath"/></p>
> <p>Servlet=<xsl:value-of select="$servletPath"/></p>
> <p>Server=<xsl:value-of select="$serverName"/></p>
> <p>Port=<xsl:value-of select="$serverPort"/></p>
> 
> 
> But, whether I try 
> http://myserver.com:8080/cocoon215/soc/pageTest 
> or
> http://soc.myserver.com/cocoon215/soc/pageTest 
> 
> I have the same results:
> 
> Context=/cocoon215
> Servlet=/soc/pageTest
> Server=myserver.com
> Port=8080
> 
> 
> In order for the application to work properly, 
> what do I need to do to get to this:
> 
> Context=/cocoon215
> Servlet=/soc/pageTest
> Server=soc.myserver.com
> Port=[null]
> 
> Any ideas how?
> 
> Thanks
> Derek
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
> 
> 
http://www.orcades.net




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org