Deploying with fcgid under a specific directory
Hello I am deploying dancer in a directory, like http://server/query instead the root path. This is my redirect configuration: RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^/query(.*)$ /query/dispatch.fcgi$1 [QSA,L] While the main page works, when I use <% request.base %>file in a template, it gets http://server/queryfile I tried to solve this, using <% request.base %>/file, but then it gets as http://server//file when testing with bin/app.pl What am I doing wrong? Also, when using "redirect /" in Dancer code, should I use "redirect /query" instead? Or "redirect request->{base}" ? Thank you ambs
On 17/12/2010 22:01, ambs wrote:
Hello
I am deploying dancer in a directory, like http://server/query instead the root path.
This is my redirect configuration:
RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^/query(.*)$ /query/dispatch.fcgi$1 [QSA,L]
While the main page works, when I use <% request.base %>file in a template, it gets http://server/queryfile
I tried to solve this, using <% request.base %>/file, but then it gets as http://server//file when testing with bin/app.pl
What am I doing wrong?
Also, when using "redirect /" in Dancer code, should I use "redirect /query" instead? Or "redirect request->{base}" ?
OK, for this one, using request->base(). Now, need to find out what to do with the above problem.
After some talk in #dancer with Franck we found out that: - apache + fcgid under a specific directory does not add an extra slash to the URI - standalone server, adds the slash because the script_name is empty. While there isn't a fix on git/CPAN, I am using: A function to replace my calls to request->base on my dancer code: sub mybase { my $base = request->base(); $base .= "/" unless $base =~ m'/$'; return $base; }; Fix the template variable uri_base so that I can use it consistently across standalone/apache ==> using <% uri_base %>name before_template sub { my $tokens = shift; my $path = request->base->path; $tokens->{uri_base} = $path eq '/' ? $path : $path.'/'; }; Please let me known when a solution is posted to cpan :) Alberto On 17/12/2010 22:07, ambs wrote:
On 17/12/2010 22:01, ambs wrote:
Hello
I am deploying dancer in a directory, like http://server/query instead the root path.
This is my redirect configuration:
RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^/query(.*)$ /query/dispatch.fcgi$1 [QSA,L]
While the main page works, when I use <% request.base %>file in a template, it gets http://server/queryfile
I tried to solve this, using <% request.base %>/file, but then it gets as http://server//file when testing with bin/app.pl
What am I doing wrong?
Also, when using "redirect /" in Dancer code, should I use "redirect /query" instead? Or "redirect request->{base}" ?
OK, for this one, using request->base(). Now, need to find out what to do with the above problem. _______________________________________________ Dancer-users mailing list Dancer-users@perldancer.org http://www.backup-manager.org/cgi-bin/listinfo/dancer-users
participants (1)
-
ambs