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

P Kishor punk.kish at gmail.com
Mon Sep 13 04:29:52 CEST 2010


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