Perl-Evozon / PearlBee

116 stars 44 forks source link

Storing the app URL in the session can cause hangs #35

Open mbethke opened 9 years ago

mbethke commented 9 years ago

I'm not sure what the rationale is for storing the application URL in the session cookie but if you change some things in the server setup it can cause problems. I just switched from a plackup development server on port 5000 to Apache and kept getting a CSS- and JS-less site that hung waiting for these resources to be loaded from the old URL. Clearing the cookie fixed this.

There are four different ways to reference these resources being used in the templates:

views/emails/new_comment.tt
10:     <link href="[% url %]/blog/css/bootstrap.min.css" rel="stylesheet">
views/emails/new_user.tt
10:     <link href="[% app_url %]/blog/css/bootstrap.min.css" rel="stylesheet">
views/layouts/admin.tt
19:      <link href="[% session.app_url %]/admin/css/bootstrap.min.css" rel="stylesheet">
views/components/datatables.tt
2:<script src="/css/DT_bootstrap.js"></script>

At least the last one will probably break on installations that don't live in the server root. Changing session.app_url to app_url in views/theme/styles.tt doesn't seem to cause any ill effects (haven't tested much though).