# Logging POST data from $request\_body and returning 200

**URL:** <https://www.ruby-forum.com/t/logging-post-data-from-request-body-and-returning-200/203683>\
**Category:** NGINX\
**Created:** [February 25, 2011, 1:17am UTC](https://www.ruby-forum.com/t/logging-post-data-from-request-body-and-returning-200/203683 "2011-02-25T01:17:00Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![luislavena](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/0ea827/32.png) [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Post date:** [February 25, 2011, 1:17am UTC](https://www.ruby-forum.com/t/logging-post-data-from-request-body-and-returning-200/203683/1 "2011-02-25T01:17:00Z")

</div>

I am able to log POST data correctly with the following code:

location /bk {  
if ($request\_method != POST) {  
return 405;  
}  
proxy\_pass $scheme://127.0.0.1:$server\_port/dummy;  
log\_format my\_tracking $request\_body;  
access\_log /mnt/logs/nginx/my.access.log my\_tracking;  
}  
location /dummy { set $test 0; }

but the requester gets a 404 return code. I’d like to return a 200 but  
when I make the following change:

location /bk {  
if ($request\_method != POST) {  
return 405;  
}  
proxy\_pass $scheme://127.0.0.1:$server\_port/dummy;  
log\_format my\_tracking $request\_body;  
access\_log /mnt/logs/nginx/my.access.log my\_tracking;  
return 200;  
}  
location /dummy { set $test 0; }

The logs are recording blank data. Any ideas on record the data with  
returning a 200?

Posted at Nginx Forum:

> **[Logging POST data from $request\_body and returning 200](https://forum.nginx.org/read.php?2,178228,178228#msg-178228)**
>
> I am able to log POST data correctly with the following code: location /bk { if ($request\_method != POST) { return 405; } proxy\_pass $scheme://127.0.0.1:$server\_port/dummy; log\_format my\_tracking $request\_body; access\_log /mnt/l
