Welcome! Log In Create A New Profile

Advanced

Re: POST request body manipulation

December 17, 2015 06:36PM
in my case, I can log the $request_body in the access_log via proxy_pass, even when uploading files more then 1MB.

I just wanted to limit the size of the $request_body in the log. Here is my nginx.conf:

http {
include mime.types;
default_type application/octet-stream;

map $request_body $request_body_short {
"~^(?<SHORT>.*filename.*)Content-Type" $SHORT;
default $request_body;
}

log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" "$http_user_agent" "$http_x_forwarded_for" $request_time '
'"$request_body_short" $http_uid "$http_build" "$http_appversion" "$uid_got" "$host"';

access_log logs/access.log main;

....
}

if I changed the map default value to something like 'wrong', the logged $request_body would be 'wrong'.
Subject Author Posted

POST request body manipulation

Sandro Bordacchini April 23, 2015 12:54PM

Re: POST request body manipulation

pumbac December 17, 2015 12:44AM

Re: POST request body manipulation

Valentin V. Bartenev December 17, 2015 06:52AM

Re: POST request body manipulation

Valentin V. Bartenev December 17, 2015 06:58AM

Re: POST request body manipulation

pumbac December 17, 2015 06:36PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 290
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready