[Dancer-users] Session collision of multiple web sites with Plack::Handler::Apache2

P Kishor punk.kish at gmail.com
Tue Sep 14 07:56:18 CEST 2010


Hi fellow dancers,

Now that I finally have Dancer running successfully with Apache2 CGI,
I actually find it more conducive to development -- no more worrying
about reloading the changes completely (I was never quite sure when
auto_reload did work and when it didn't).

That said, I would really like to solve my problem below as soon I
will be moving to production, and would want to go to a mod_perl based
environment (I am still having problems with FastCGI... more on that
in a separate email).

If one of your dancers and shakers can look at my problem below and
provide me some guidance, it would be much appreciated.

Graçias.

On Mon, Sep 13, 2010 at 4:29 AM, P Kishor <punk.kish at gmail.com> wrote:
> I had been experiencing strange problems until I inadvertently
> discovered, what I believe, is the cause. I have several Dancer-based
> web sites hosted with Plack::Handler::Apache2 and virtual hosts on the
> same server. Well, the config info of one web site is visible in and
> affects the other web sites.
>
> All my virtual hosts have a Location / section in their respective
> definitions like so
>
> NameVirtualHost *:80
>
> <VirtualHost *:80>
>    ServerName app1.org
>    DocumentRoot "/Users/punkish/Sites/app1"
>
>    <Directory "/Users/punkish/Sites/app1">
>        AllowOverride None
>        Order allow,deny
>        Allow from all
>    </Directory>
>
>    <Location />
>        SetHandler perl-script
>        PerlHandler Plack::Handler::Apache2
>        PerlSetVar psgi_app /Users/punkish/Sites/app1/app1.pl
>    </Location>
> </VirtualHost>
>
> <VirtualHost *:80>
>    ServerName app2.org
>    DocumentRoot "/Users/punkish/Sites/app2"
>
>    <Directory "/Users/punkish/Sites/app2">
>        AllowOverride None
>        Order allow,deny
>        Allow from all
>    </Directory>
>
>    <Location />
>        SetHandler perl-script
>        PerlHandler Plack::Handler::Apache2
>        PerlSetVar psgi_app /Users/punkish/Sites/app2/app2.pl
>    </Location>
> </VirtualHost>
>
> However, when I look at the debug info (actually, I had an error in my
> code, which caused a runtime error, and the error messages were
> written to the browser... that is when I discovered this situation), I
> see this "collision." Basically, when I go to http://app2.org, I see
> the config info from app1. I believe this is because in Apache's
> memory, all the psgi_apps are being loaded once, and they are
> colliding.
>
> What can I do to avoid this? The obvious answer is to use CGI, but
> surely, I should be able to host multiple, different Dancer apps on
> the same Apache server, no?
>




-- 
Puneet Kishor http://www.punkish.org
Carbon Model http://carbonmodel.org
Charter Member, Open Source Geospatial Foundation http://www.osgeo.org
Science Commons Fellow, http://sciencecommons.org/about/whoweare/kishor
Nelson Institute, UW-Madison http://www.nelson.wisc.edu
-----------------------------------------------------------------------
Assertions are politics; backing up assertions with evidence is science
=======================================================================


More information about the Dancer-users mailing list