[Dancer-users] Global app-wide "prefix" settings

Assaf Gordon gordon at cshl.edu
Wed Sep 28 22:07:33 CEST 2011


sawyer x wrote, On 09/28/2011 03:33 PM:
> On Wed, Sep 28, 2011 at 9:22 PM, Assaf Gordon <gordon at cshl.edu <mailto:gordon at cshl.edu>> wrote:
> 
>     I understand the apache configuration part, but not the dancer part:
> 
>     In my Dancer/Template-Toolkit file (e.g. "views/layout/main.tt <http://main.tt>"), I'm still using:
>       <img src="[% request.uri_base %]/images/pic.jpg"/>
>     and
>       <link rel="stylesheet" href="[% request.uri_base %]/css/style.css" />
> 
>     So the link (inside the generated HTML that the user will receive) will contain:
>      http://server.cshl.edu/images/pic.jpg
>     and
>      http://server.cshl.edu/css/style.css
> 
> 
> Indeed that's what the users will get. Then they have to run another request to the server to retrieve it, and that's when they hit the Alias rule which tells the apache "they're asking for /images/ but they actually want /app/images".

I must be missing something big, because I just don't get it :)

1. If the user gets <src img="http://server.cshl.edu/images/pic.jpg"> and then retrieves it, 
an alias rule "Alias /app1/images /path/to/app1/public/images" (as suggested by Pedro Melo) will *not* catch it - unless I don't understand the meaning of Apache's "Alias".

2. If I have two dancer applications, and both generate URLS of "http://server.cshl.edu/images/pic.jpg" - how is it possible for apache to tell if this image belongs to the first application or the second ?


Perhaps I'm not explaining myself well.
I'll try to ask it in a different way:

Has anyone been able to deploy a Dancer application *not* under the server's root URL,
without changing code/templates in the Dancer application itself ?

That is:
1. create default dancer application.
   the index route's URL is "/"
   the images URL is "/images/*"
   the CSS URL is "/css/*"

2. SOME CONFIGURATION in Apache ??

3. The root URL of the entire application is now "/gordon/":
  the index route's URL is "/gordon/"
  the images URL is "/gordon/images/*"
  the CSS URL is "/gordon/css/*"

What should I do in step 2 ?



More information about the Dancer-users mailing list