Q:

How to get cookies using FCGI

I have the following Perl FastCGI script:
#!/usr/bin/perl
use warnings;
use strict;
use FCGI;
use POSIX;
use FindBin qw($Bin);
use FCGI::ProcManager qw(pm_manage pm_pre_dispatch pm_post_dispatch);   

use Data::Dumper;

&demonize();

my $socket = FCGI::OpenSocket(":9000", 5); 

my $request = FCGI::Request(\*STDIN, \*STDOUT, \*STDERR, \%ENV, $socket, FCGI::FAIL_ACCEPT_ON_INTR);

pm_manage(n_processes => 2);

chdir $Bin or die "Error::$!\n";

while($request->Accept() >= 0 ) {
     pm_pre_dispatch();

         print "\%ENV => \n ", Dumper($env), "\n\n";

         pm_post_dispatch();
}

.....

I deployed my application on nginx with the following configuration:
server {
    listen 80;
    server_name eventise.my;

    root /home/tigran/Documents/Development/perl/eventise/www;

    location / {
        index   index.html;
   }    

    location ~* \.(gif|jpg|png|js|css|html)$ {
        expires 30d;
   }

    location /perl/ {
        fastcgi_pass   localhost:9000;  

        fastcgi_param SCRIPT_FILENAME /home/tigran/Documents/Development/perl/eventise/fcgi-bin$fastcgi_script_name;
        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 REQUEST_URI     $request_uri;
        fastcgi_param DOCUMENT_URI    $document_uri;
        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; 
        fastcgi_pass_header Cookie;     
    }
}

When I send a request with a cookie to my app using Chrome's Advanced REST client, I don't see the cookie in %ENV. Instead I see:
%ENV => 
 $VAR1 = {
          'HTTP_ACCEPT' => 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8',
          'REQUEST_METHOD' => 'GET',
          'SCRIPT_FILENAME' => '/home/tigran/Documents/Development/perl/eventise/fcgi-bin/perl/',
          'HTTP_USER_AGENT' => 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.77 Safari/537.36',
          'REMOTE_PORT' => '56832',
          'QUERY_STRING' => '',
          'HTTP_CACHE_CONTROL' => 'max-age=0',
          'HTTP_ACCEPT_LANGUAGE' => 'en-US,en;q=0.8',
          'FCGI_ROLE' => 'RESPONDER',
          'CONTENT_TYPE' => '',
          'DOCUMENT_URI' => '/perl/',
          'SERVER_NAME' => 'eventise.my',
          'HTTP_ACCEPT_ENCODING' => 'gzip,deflate,sdch',
          'HTTP_CONNECTION' => 'keep-alive',
          'CONTENT_LENGTH' => '',
          'SERVER_PORT' => '80',
          'REMOTE_ADDR' => '127.0.0.1',
          'REQUEST_URI' => '/perl/',
          'SERVER_ADDR' => '127.0.1.1',
          'HTTP_HOST' => 'eventise.my'
        };

Where did I go wrong?

A:

It looks like the Chrome Advanced REST Client does not support cookies:

But it is not possible to set "Cookie" header because specification
  not allow it. See
  http://www.w3.org/TR/XMLHttpRequest/#the-setrequestheader-method for
  more information.

More details: http://blog.getpostman.com/index.php/2013/09/18/legacy-app-update-cookies-and-devtools-for-v0-9-x/
You could use an older version of Postman to send/edit cookies or you could use Postman Proxy for this:

One workaround is to use the Postman Proxy to set the cookie header
  with the cookie value obtained from the browser.
I think this is quite clunky and can be improved upon. If the API you
  are testing uses cookies, I would suggest sticking keeping v0.8.x
  installed. As v0.8.x and v0.9.x are available as separate apps, you
  can use them in parallel to get the most out of Postman.

