Forum: NGINX Logging embedded Perl return value

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
davidc (Guest)
on 2009-04-09 07:53
(Received via mailing list)
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
Igor S. (Guest)
on 2009-04-09 09:34
(Received via mailing list)
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.
davidc (Guest)
on 2009-04-10 06:06
(Received via mailing list)
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
Igor S. (Guest)
on 2009-04-10 14:48
(Received via mailing list)
Attachment: patch.any_status (0 Bytes)
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 topic is locked and can not be replied to.