From aca12b17dfe9b3951c4aa6b31a13672d1d681d50 Mon Sep 17 00:00:00 2001 From: Dmytro Date: Thu, 16 May 2024 00:50:35 +0100 Subject: [PATCH] Add post request timeout, add request body to the log --- config/nginx.conf | 2 +- proxy/helper.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/config/nginx.conf b/config/nginx.conf index 588f1a2..5934398 100644 --- a/config/nginx.conf +++ b/config/nginx.conf @@ -5,7 +5,7 @@ events { worker_processes auto; http { - log_format upstreamlog '[$time_local] $request $status $host - $remote_addr to: $upstream_addr - urt: $upstream_response_time msec: $msec req_t: $request_time ($http_referer $http_user_agent)'; + log_format upstreamlog '[$time_local] $request $status - $request_body - $host - $remote_addr to: $upstream_addr - urt: $upstream_response_time msec: $msec req_t: $request_time ($http_referer $http_user_agent)'; access_log /var/log/nginx/access.log upstreamlog; limit_req_zone $binary_remote_addr zone=one:10m rate=200r/s; diff --git a/proxy/helper.py b/proxy/helper.py index 945150e..cede321 100644 --- a/proxy/helper.py +++ b/proxy/helper.py @@ -74,7 +74,8 @@ def post_request(url, json, cookies=None): return requests.post( url, json=json, - cookies=cookies + cookies=cookies, + timeout=30 ) except requests.exceptions.RequestException: return None