We have web api with multiple endpoints behind nginx (1.18.0 on Ubuntu 20) proxy. Everything works fine but one scenario. When user whith our company's Android app tries to upload attchment using one specific endpoint to server behind nginx and one's network connectivity is quite poor one's POST requests simply don't reach the server. All other endpoint are reachable with no problems. As admin i can see long tcp stream client->nginx, i see 400 error in nginx log with zero bytes sent to proxied api server. Wireshark shows no POST request nginx->server.
With good network speed everything works ok. We tested this scenario with traffic shaper and yes, realy nginx stopped to pass upload POST request to api server.
Our config:
upstream my_backend {
server app.ours.local:8080;
keepalive 60;
}
Server {
listen 443 ssl;
server_name our.server;
ssl_certificate /etc/nginx/ssl/chain.crt;
ssl_certificate_key /etc/nginx/ssl/private.key;
keepalive_timeout 40;
access_log /var/log/nginx/our.access.log upstreamlog;
error_log /var/log/nginx/our.error.crit.log crit;
error_log /var/log/nginx/our.error.alert.log alert;
error_log /var/log/nginx/our.error.emerg.log emerg;
error_log /var/log/nginx/our.error.log error;
error_log /var/log/nginx/our.error.warn.log warn;
default_type application/json;
client_max_body_size 100M;
proxy_http_version 1.1;
proxy_redirect off;
proxy_buffering on;
proxy_read_timeout 120s;
proxy_pass_header Authorization;
proxy_set_header Connection "";
proxy_connect_timeout 30s;
proxy_send_timeout 30s;
client_body_timeout 60s;
}
location / {
return 404 "Not found.";
}
location /MobApp/ODataV4/AddServiceFile {
proxy_set_header Host my_backend;
rewrite ^/MobApp/ODataV4/ /api/ODataV4/APIManagement_AddMMRequestFile?company=Ours break;
proxy_pass https://my_backend;
}
We need our nginx proxy server proceeds long request from slow clients the to app server behind nginx like it does for normal speed clients. Now it's simply doesn't pass any packet at all.
I see only one message in access logs and zero in error:
[02/Jun/2023:11:32:30 +0300] status - 400 x.x.x.x - our.server to: y.y.y.y:8080: POST /MobApp/ODataV4/AddServiceFile HTTP/1.1 /api/ODataV4/APIManagement_AddMMRequestFile - bytes_sent - 0
We've tried to play with proxy_ buffer and client_buffer settings like timeouts and caching on/off. It doesn't work. Now i have no idea how make nginx proceed such request so any hints, ideas, guesses - please help :-)