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/26 11:08:00 UTC

[SOLVED] Re: Cocoon with Virtual Hosts (apache/tomcat)

What we did was:

Add this line:
    ProxyPreserveHost  
Then these next two lines make up the balance of the transfer to
tomcat
    ProxyPass /cocoon215/soc http://localhost:8080/cocoon215/soc 
    ProxyPassReverse /cocoon215/soc
http://localhost:8080/cocoon215/soc

Hope this might help someone...

Derek

>>> uv@upaya.co.uk 2005/01/25 10:38:09 AM >>>
Derek,

You could go jk2 route - just that, in my view, you'd loose a great
deal 
of flexibility.

This WILL in my view be relatively easy to fix. It is going to be 
something simple.

Here's some things to try:

1) Switch on (temporarily) rewrite logging. Setting of 3 should give
you 
enough info to go on.
2) If you're on Unix, try using Lynx or some such to use the 
http://localhost:8080/ URL to see if it works correctly from within the

server
3) Check that the rewrite logs are rewritingg to that particular URL

Hmm. Looking at what I wrote below, I missed [P,L] from the end of the

line. It should be:

RewriteRule /cocoon215/soc(.*) http://localhost:8080/cocoon215/soc$1
[P,L]

P says proxy the request to this URL
L says this is the last rule. Do not process any other rules.

Hope that is enough to get you going.

Regards, Upayavira




Derek Hohls wrote:

>The admin tried this and we get the same results(problems)
>
>Any other ideas?
>
>Thanks
>Derek
>
>  
>
>>>>uv@upaya.co.uk 2005/01/19 03:52:28 PM >>>
>>>>        
>>>>
>Instead of:
>
>ProxyPass /cocoon215/soc http://localhost:8080/cocoon215/soc 
>you should use:
>RewriteRule /cocoon215/soc(.*) http://localhost:8080/cocoon215/soc$1 
>
>You should still use the ProxyPassReverse rule.
>
>Try that.
>
>Regards, Upayavira
>
>
>
>
>Derek Hohls wrote:
>
>  
>
>>Upayavira
>>
>>Apparently that was tried as well .... the problem in that
>>case is that the :8080 is still retained in the response 
>>coming back from the ProxyPassReverse and so the 
>>site is then effectively not viewable from outside the local
>>network.
>>
>>Any other ideas?
>>
>>Derek
>>
>>
>>
>>    
>>
>>>>>uv@upaya.co.uk 2005/01/19 11:55:18 AM >>>
>>>>>
>>>>>          
>>>>>
>>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 
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org 
>>For additional commands, e-mail: users-help@cocoon.apache.org 
>>
>>
>>
>>    
>>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org 
>For additional commands, e-mail: users-help@cocoon.apache.org 
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org 
>For additional commands, e-mail: users-help@cocoon.apache.org 
>
>
>  
>


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


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