You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Jason Lane <ja...@root10.net> on 2004/06/06 17:51:48 UTC

Cocoon hosting config hints

Hi list,

We are acquiring a new server (2Ghz G5 XServe. hmmmmm.) that we are 
going to collocate. We will eventually have different domains running 
Cocoon. The question is have you any tips / suggestions you could give 
me.

For example is multiple instances of Cocoon a good idea, or should we 
just mange everything through one instance.

Your advice is much appreciated

Jason


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


Re: Cocoon hosting config hints

Posted by ad...@free.fr.
Thanks for your answer; I am not sure that I quite understood it, though:(

To detail my question, say you try this:

http://mycocoonhost/  mapped to http://localhost:8080/cocoon/myapp/

provided that /etc/hosts contains, just as you said:

127.0.0.1 localhost mycocoonhost

(the two names refer to the same local IP).


The configuration in the httpd.conf should then be something like:

<VirtualHost *>
	ServerName mycocoonhost
	ProxyPass / http://localhost:8080/cocoon/myapp/
	ProxyPassReverse / http://localhost:8080/cocoon/myapp/
</VirtualHost>

Let's also say that /cocoon/myapp is a webapp using cookies to store
HttpSession state. A cookie generated at the first visit by myapp would be:

Set-Cookie: foo=bar; path=/cocoon/myapp; expires Mon, 09-Dec-2004
13:46:00 GMT

The browser gets this cookie. Next time it accesses the webapp, as the
path the browser sees is NOT /coocon/myapp but simply / , it would NOT
send the cookie, so the user will never get to maintain http state.

I am sorry if your example was explaining just this, please bear with me :)

Thanks again,
Adrian.


> Use local domain names. It is a hack, but it works.
> 
> So, in my /etc/hosts I have:
> www.v1.1.mysite.com
> www.v1.2.mysite.com
> all pointing to the local server.
> Then, Jetty mounts those domain names.


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


Re: Cocoon hosting config hints

Posted by Jason Lane <ja...@root10.net>.
This is great, thanks .... Yes I'd looked at proxying, looks very cool.


On 7 Jun 2004, at 13:29, Upayavira wrote:

> adrian.dimulescu@free.fr wrote:
>
>>
>> Upayavira wrote:
>>
>>> Run them with Apache in front (see 
>>> wiki.cocoondev.org?Page=ApacheModProxy). With Apache virtual 
>>> hosting, you can do clever stuff to proxy requests to the correct 
>>> Cocoon instance.
>>>
>>> We have at any one time two or three versions of our webapp running, 
>>> each in their own Cocoon webapp, with mod_proxy and mod_rewrite 
>>> switching between different versions for different clients.
>>>
>>> If you need to handle lots of sites, and want to use the same 
>>> Cocoon, check out the host selector.
>>
>>
>> Hello,
>>
>> I am equally wondered by the cool possibilities of proxying, yet 
>> there remains the great problem of cookies being dependant on webapp 
>> path.
>>
>> How do you get around that one ?
>
> Use local domain names. It is a hack, but it works.
>
> So, in my /etc/hosts I have:
> www.v1.1.mysite.com
> www.v1.2.mysite.com
> all pointing to the local server.
> Then, Jetty mounts those domain names.
>
> So long as you remember to do ProxyPassReverse to handle redirects, 
> you can have multiple webapps, mounted on different (internal only) 
> domain names, with no session cookie trouble. Works a treat.
>
> Actually, I have:
> www.host1.v1.1.mysite.com
> www.host2.v1.1.mysite.com
> www.host1.v1.2.mysite.com
> www.host2.v1.2.mysite.com
> etc, etc. (Then add wap. and pda. you get a lot of options), so that 
> there's load balancing going on.
>
> I've got a script that generates an httpd.conf file (included into 
> httpd.conf itself), jetty config files, /etc/hosts files, and a number 
> of rewriteMap files.
>
> Clever stuff really.
>
> Hope that helps.
>
> Regards, Upayavira
>
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>
>
Jason Lane

Developer
Root10 developments


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


Re: Cocoon hosting config hints

Posted by Upayavira <uv...@upaya.co.uk>.
adrian.dimulescu@free.fr wrote:

> Upayavira wrote:
>
>> Basically, you've got to get Jetty (or tomcat) to mount the webapp 
>> without the /cocoon/. Then, you mount your app on /, so that 
>> http://localhost:8080/ is your application, so that:
>>
>> http://mycocoonhost/ maps to http://localhost:8080/
>
> Yes, that's what I thought. It's a pain though, I would have much 
> preferred that mod_proxy also rewrite the cookie path.

Yup. I'm sure there's a way - some Apache module somewhere. Just need to 
find it.

>> The more complex stuff I was talking about was how to manage more 
>> than one webapp mounted onto different domain names.
>
> AFAICS you won't be able to do that with cookie-based sessions just 
> because of that cookie problem : you only have one root webpath to map 
> to. Unless you mount every app in the root of its own domain name. 
> Which is just what you were saying in the last mail... Ok, it took a 
> while to get it :)

Good. Took me a while. A hack, but it works.

>> What servlet container are you using? Jetty or Tomcat?
>
> > Then we can look at how to reconfigure it to do that.
>
> I'm on Tomcat; no problem about reconfiguring things, thanks; it's 
> just that deploying a webapp in the webapps/ directory is so much 
> simpler.

Okay.

> What's with Jetty, I never tried it: is it simpler, is it faster or 
> what ?

Lighter, for me more reliable. Apparently  has a far lower memory 
footprint.

Regards, Upayavira



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


Re: Cocoon hosting config hints

Posted by ad...@free.fr.
Upayavira wrote:

> Basically, you've got to get Jetty (or tomcat) to mount the webapp 
> without the /cocoon/. Then, you mount your app on /, so that 
> http://localhost:8080/ is your application, so that:
> 
> http://mycocoonhost/ maps to http://localhost:8080/

Yes, that's what I thought. It's a pain though, I would have much 
preferred that mod_proxy also rewrite the cookie path.

> The more complex stuff I was talking about was how to manage more than 
> one webapp mounted onto different domain names.

AFAICS you won't be able to do that with cookie-based sessions just 
because of that cookie problem : you only have one root webpath to map 
to. Unless you mount every app in the root of its own domain name. Which 
is just what you were saying in the last mail... Ok, it took a while to 
get it :)

> What servlet container are you using? Jetty or Tomcat?
 > Then we can look at how to reconfigure it to do that.

I'm on Tomcat; no problem about reconfiguring things, thanks; it's just 
that deploying a webapp in the webapps/ directory is so much simpler.

What's with Jetty, I never tried it: is it simpler, is it faster or what ?

Regards,
Adrian.

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


Re: Cocoon hosting config hints

Posted by Upayavira <uv...@upaya.co.uk>.
dadi@scriptorium.ro wrote:

> Thanks for your answer; I am not sure that I quite understood it, 
> though:(
>
> To detail my question, say you try this:
>
> http://mycocoonhost/  mapped to http://localhost:8080/cocoon/myapp/ 

Actually, reading your problem again, it is simpler than I was thinking.

Basically, you've got to get Jetty (or tomcat) to mount the webapp 
without the /cocoon/. Then, you mount your app on /, so that 
http://localhost:8080/ is your application, so that:

http://mycocoonhost/ maps to http://localhost:8080/

The more complex stuff I was talking about was how to manage more than 
one webapp mounted onto different domain names.

What servlet container are you using? Jetty or Tomcat?

Then we can look at how to reconfigure it to do that.

Regards, Upayavira



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


Re: Cocoon hosting config hints

Posted by da...@scriptorium.ro.
Thanks for your answer; I am not sure that I quite understood it, though:(

To detail my question, say you try this:

http://mycocoonhost/  mapped to http://localhost:8080/cocoon/myapp/

provided that /etc/hosts contains, just as you said:

127.0.0.1 localhost mycocoonhost

(the two names refer to the same local IP).


The configuration in the httpd.conf should then be something like:

<VirtualHost *>
	ServerName mycocoonhost
	ProxyPass / http://localhost:8080/cocoon/myapp/
	ProxyPassReverse / http://localhost:8080/cocoon/myapp/
</VirtualHost>

Let's also say that /cocoon/myapp is a webapp using cookies to store 
HttpSession state. A cookie generated at the first visit by myapp would be:

Set-Cookie: foo=bar; path=/cocoon/myapp; expires Mon, 09-Dec-2004 
13:46:00 GMT

The browser gets this cookie. Next time it accesses the webapp, as the 
path the browser sees is NOT /coocon/myapp but simply / , it would NOT 
send the cookie, so the user will never get to maintain http state.

I am sorry if your example was explaining just this, please bear with me :)

Thanks again,
Adrian.


> Use local domain names. It is a hack, but it works.
> 
> So, in my /etc/hosts I have:
> www.v1.1.mysite.com
> www.v1.2.mysite.com
> all pointing to the local server.
> Then, Jetty mounts those domain names.

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


Re: Cocoon hosting config hints

Posted by Upayavira <uv...@upaya.co.uk>.
adrian.dimulescu@free.fr wrote:

>
> Upayavira wrote:
>
>> Run them with Apache in front (see 
>> wiki.cocoondev.org?Page=ApacheModProxy). With Apache virtual hosting, 
>> you can do clever stuff to proxy requests to the correct Cocoon 
>> instance.
>>
>> We have at any one time two or three versions of our webapp running, 
>> each in their own Cocoon webapp, with mod_proxy and mod_rewrite 
>> switching between different versions for different clients.
>>
>> If you need to handle lots of sites, and want to use the same Cocoon, 
>> check out the host selector.
>
>
> Hello,
>
> I am equally wondered by the cool possibilities of proxying, yet there 
> remains the great problem of cookies being dependant on webapp path.
>
> How do you get around that one ?

Use local domain names. It is a hack, but it works.

So, in my /etc/hosts I have:
www.v1.1.mysite.com
www.v1.2.mysite.com
all pointing to the local server.
Then, Jetty mounts those domain names.

So long as you remember to do ProxyPassReverse to handle redirects, you 
can have multiple webapps, mounted on different (internal only) domain 
names, with no session cookie trouble. Works a treat.

Actually, I have:
www.host1.v1.1.mysite.com
www.host2.v1.1.mysite.com
www.host1.v1.2.mysite.com
www.host2.v1.2.mysite.com
etc, etc. (Then add wap. and pda. you get a lot of options), so that 
there's load balancing going on.

I've got a script that generates an httpd.conf file (included into 
httpd.conf itself), jetty config files, /etc/hosts files, and a number 
of rewriteMap files.

Clever stuff really.

Hope that helps.

Regards, Upayavira






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


Re: Cocoon hosting config hints

Posted by ad...@free.fr.
Upayavira wrote:

> Run them with Apache in front (see 
> wiki.cocoondev.org?Page=ApacheModProxy). With Apache virtual hosting, 
> you can do clever stuff to proxy requests to the correct Cocoon instance.
> 
> We have at any one time two or three versions of our webapp running, 
> each in their own Cocoon webapp, with mod_proxy and mod_rewrite 
> switching between different versions for different clients.
> 
> If you need to handle lots of sites, and want to use the same Cocoon, 
> check out the host selector.

Hello,

I am equally wondered by the cool possibilities of proxying, yet there 
remains the great problem of cookies being dependant on webapp path.

How do you get around that one ?

Thanks,
Adrian.

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


Re: Cocoon hosting config hints

Posted by Upayavira <uv...@upaya.co.uk>.
Jason Lane wrote:

> Hi list,
>
> We are acquiring a new server (2Ghz G5 XServe. hmmmmm.) that we are 
> going to collocate. We will eventually have different domains running 
> Cocoon. The question is have you any tips / suggestions you could give 
> me.
>
> For example is multiple instances of Cocoon a good idea, or should we 
> just mange everything through one instance.

Multiple instances of Cocoon is fine, but keep the number low - run them 
all in the same servlet container if you can (I'd strongly recommend 
Jetty over Tomcat).

Run them with Apache in front (see 
wiki.cocoondev.org?Page=ApacheModProxy). With Apache virtual hosting, 
you can do clever stuff to proxy requests to the correct Cocoon instance.

We have at any one time two or three versions of our webapp running, 
each in their own Cocoon webapp, with mod_proxy and mod_rewrite 
switching between different versions for different clients.

If you need to handle lots of sites, and want to use the same Cocoon, 
check out the host selector.

That's my thoughts.

Regards, Upayavira



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