[Dancer-users] path_info is not set up

Иван Бессарабов ivan at bessarabov.ru
Wed Jan 26 08:37:39 CET 2011


I have the default fastcgi_params file, so its content:
**********
fastcgi_param  QUERY_STRING       $query_string;
fastcgi_param  REQUEST_METHOD     $request_method;
fastcgi_param  CONTENT_TYPE       $content_type;
fastcgi_param  CONTENT_LENGTH     $content_length;

fastcgi_param  SCRIPT_NAME        $fastcgi_script_name;
fastcgi_param  REQUEST_URI        $request_uri;
fastcgi_param  DOCUMENT_URI       $document_uri;
fastcgi_param  DOCUMENT_ROOT      $document_root;
fastcgi_param  SERVER_PROTOCOL    $server_protocol;

fastcgi_param  GATEWAY_INTERFACE  CGI/1.1;
fastcgi_param  SERVER_SOFTWARE    nginx/$nginx_version;

fastcgi_param  REMOTE_ADDR        $remote_addr;
fastcgi_param  REMOTE_PORT        $remote_port;
fastcgi_param  SERVER_ADDR        $server_addr;
fastcgi_param  SERVER_PORT        $server_port;
fastcgi_param  SERVER_NAME        $server_name;

# PHP only, required if PHP was built with --enable-force-cgi-redirect
fastcgi_param  REDIRECT_STATUS    200;
**********

I've read about fastcgi_split_path_info, but I don't understand what
logic should I give it. I don't understan what PATH_INFO should
contain.



26 января 2011 г. 9:49 пользователь Dave Doyle <dave.s.doyle at gmail.com> написал:
> Utterly wild stab in the dark, since I don't deploy using fastcgi: What's in
> your /etc/nginx/fastcgi_params?
> After googling it I found people have had problems with PATH_INFO in Nginx.
> Perhaps this part of the Nginx wiki is applicable?
> http://wiki.nginx.org/HttpFcgiModule#fastcgi_split_path_info
> Thanks,
> meraxes
> --
> dave.s.doyle at gmail.com
>
>
> 2011/1/26 Иван Бессарабов <ivan at bessarabov.ru>
>>
>> I'm running dancer app with plackup:
>>
>> DANCER_ENVIRONMENT='development' plackup -s FCGI --port 3001 myapp.pl
>>
>> I'm using nginx as a web sever. Here is part of its config:
>>
>> server {
>>    listen   3000;
>>    location / {
>>        fastcgi_pass   127.0.0.1:3001;
>>        include /etc/nginx/fastcgi_params;
>>    }
>> }
>>
>> With this configuration I can access the main page of my app, but only
>> it. In development.log I always get:
>>
>> [27975]  core @0.000759> request: GET / from 1.1.1.1 in
>> /usr/share/perl5/Dancer/Handler.pm l. 49
>>
>> To find out why this is so I've added 3 lines to before sub in my app:
>>
>>        debug request->{path};
>>        debug request->path_info();
>>        debug request->to_string();
>>
>> After restarting plackup, I access "/":
>>
>> [28457]  core @0.000769> request: GET / from 1.1.1.1 in
>> /usr/share/perl5/Dancer/Handler.pm l. 49
>> ...
>> [28457] debug @0.035033> [hit #1]/ in /var/www/myapp/lib/myapp.pm l. 41
>> [28457] debug @0.035033> [hit #1]/ in /var/www/myapp/lib/myapp.pm l. 42
>> [28457] debug @0.038886> [hit #1][#1] GET / in /var/www/myapp/lib/myapp.pm
>> l. 43
>>
>> And here is the log when I try to access "/abc" (in the browser I
>> still see the main page):
>>
>> [28457]  core @0.000246> request: GET / from 1.1.1.1 in
>> /usr/share/perl5/Dancer/Handler.pm l. 49
>> ...
>> [28457] debug @0.016833> [hit #2]/abc in /var/www/myapp/lib/myapp.pm l. 41
>> [28457] debug @0.018028> [hit #2]/ in /var/www/myapp/lib/myapp.pm l. 42
>> [28457] debug @0.018363> [hit #2][#2] GET /abc in
>> /var/www/myapp/lib/myapp.pm l. 43
>>
>>
>> I looked through the dancer code and found out that is be because
>> $self->{env}->{'PATH_INFO'} is empty line in sub _build_path_info in
>> the file Request.pm
>>
>> A dirty workaroud is to place "request->path_info(request->{path});"
>> in before sub in the app. But this is bad because redirects do not
>> work.
>>
>> So. My question is: how can I fix populating PATH_INFO in my app,
>> running with plackup and nginx.
>> _______________________________________________
>> Dancer-users mailing list
>> Dancer-users at perldancer.org
>> http://www.backup-manager.org/cgi-bin/listinfo/dancer-users
>
>


More information about the Dancer-users mailing list