Subject: | uri_for() calculates incorrect paths under recent Lighttpd |
Hello,
Properly reporting here what I said on IRC.
Context: trying to deploy a working web application, made with Catalyst 5.8 and
currently running via FastCGI under Lighttpd onto a new server.
current servers: Debian 5.0 lenny, Lighttpd 1.4.19, Catalyst 5.80015, Perl 5.10.0
new servers: Debian 7.0 wheezy, Lighttpd 1.4.31, Catalyst 5.90030, Perl 5.14.2
When trying to run the application, it appears that uri_for() returns inccorect
paths, duplicating the path, therefore generating incorrect URLs which end up 404.
Here are the steps to reproduce the problem from scratch:
$ cd /home/voice/current/cgi-bin
$ catalyst.pl Derpy
$ cd Derpy
$ script/derpy_create.pl controller Muffin
$ patch -p0 < ../Derpy-muffin.diff # see attached file
$ sudo service lighttpd restart # using attached lighty config
$ curl -s http://derpy.your.hostname/muffin | head -2
<html><body><pre>
c.uri_for('/muffin') = http://derpy.your.hostname/muffin/muffin
"I just don't know what went wrong", but it looks very wrong even to my
Catalyst newbie eyes.
Happy Derpy, unhappy me
http://fc09.deviantart.net/fs70/i/2012/285/5/5/muffin__by_tsitra360-d5hmvem.jpg
Just in case, the complete c.request.env dump:
$ curl http://derpy.your.hostname/muffin
<html><body><pre>
c.uri_for('/muffin') = http://derpy.your.hostname/muffin/muffin
DOCUMENT_ROOT = /home/voice/trunk/cgi-bin/Derpy/
FCGI_ROLE = RESPONDER
GATEWAY_INTERFACE = CGI/1.1
HTTP_ACCEPT = */*
HTTP_HOST = derpy.your.hostname
HTTP_USER_AGENT = curl/7.26.0
PATH_INFO =
QUERY_STRING =
REDIRECT_STATUS = 200
REMOTE_ADDR = 192.168.21.206
REMOTE_PORT = 54995
REQUEST_METHOD = GET
REQUEST_URI = /muffin
SCRIPT_FILENAME = /home/voice/trunk/cgi-bin/Derpy/muffin
SCRIPT_NAME = /muffin
SERVER_ADDR = 192.168.21.206
SERVER_NAME = derpy.your.hostname
SERVER_PORT = 80
SERVER_PROTOCOL = HTTP/1.1
SERVER_SOFTWARE = lighttpd/1.4.31
psgi.errors = IO::Handle=GLOB(0x3ed6c38)
psgi.input = IO::Handle=GLOB(0x3ed6b90)
psgi.multiprocess = 1
psgi.multithread =
psgi.nonblocking =
psgi.run_once =
psgi.streaming = 1
psgi.url_scheme = http
psgi.version = ARRAY(0x3b4cf18)
psgix.harakiri =
</pre></body></html>
t0m suggested me to manually enable Plack::Middleware::LighttpdScriptNameFix,
but I don't see how to do that with the script/derpy_fastcgi.pl generated by
Catalyst 5.9.
In the module documentation, Miyagawa points to Lighttpd's option
fix-root-scriptname, but it has no effect.
Regards
--
Close the world, txEn eht nepO.
Subject: | Derpy-muffin.diff |
--- lib/Derpy/Controller/Muffin.pm 2013-06-11 14:18:43.767466001 +0200
+++ lib/Derpy/Controller/Muffin.pm 2013-06-11 14:15:27.579466003 +0200
@@ -24,10 +24,22 @@
sub index :Path :Args(0) {
my ( $self, $c ) = @_;
- $c->response->body('Matched Derpy::Controller::Muffin in Muffin.');
+ $c->forward('muffin');
}
+sub muffin :Local :Args(0) {
+ my ( $self, $c ) = @_;
+
+ my $body = "c.uri_for('/muffin') = " . $c->uri_for('/muffin') . "\n\n";
+
+ my $env = $c->request->env;
+ $body .= join $/, map "$_ = $env->{$_}", sort keys %$env;
+ $body = "<html><body><pre>\n$body\n</pre></body></html>\n";
+
+ $c->response->body($body);
+}
+
=head1 AUTHOR
A clever guy
Subject: | derpy.lighty.conf |
Message body not shown because it is not plain text.