Logging embedded Perl return value

I’m testing the embedded perl module. Is it possible to log the return
value?

i.e. can I set $return to capture the return value of the handler in
this example?

log_format main ‘Return value is $return’;

access_log /path/to/access.log main;

server {
location / {
perl Module::handler;
}
}

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,933,933#msg-933

On Wed, Apr 08, 2009 at 11:41:43PM -0400, davidc wrote:

     perl Module::handler;
}

}

The return value become a value of the $status variable.

Thanks for the speedy nginx and speedy reply Igor.

The $status value does indeed log the 200 response.

Is it possible to configure nginx to return custom http status codes?

e.g. use a 299 and 298 code that are interpreted as a 200 OK by a custom
http client. The last two digits would signal information that would
otherwise
have to be contained in a new header or body.

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,933,936#msg-936

On Thu, Apr 09, 2009 at 04:54:27AM -0400, davidc wrote:

Thanks for the speedy nginx and speedy reply Igor.

The $status value does indeed log the 200 response.

Is it possible to configure nginx to return custom http status codes?

e.g. use a 299 and 298 code that are interpreted as a 200 OK by a custom
http client. The last two digits would signal information that would otherwise
have to be contained in a new header or body.

The attached patch allows to use any status code in the “return”
directive
and the perl module.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs