NGINX - {“status”:400,“message”:“Bad request”} Every alternate request getting 400

satscreate sathish.create at gmail.com
Sat Mar 14 13:37:42 UTC 2020


I Have below nginx config and the api hit works fine every first time and
alternate hit getting 400.

nginx.conf:

http {

  lua_package_path '~/lua/?.lua;;';

  # Allow larger than normal headers
  large_client_header_buffers 4 64k;

  ssl_session_cache   shared:SSL:10m;
  ssl_session_timeout 10m;

include /etc/nginx/gateway.conf;
}
gateway.conf

server {

listen 443 ssl;

location = /_dosomething {
    internal;

    # Validate oauth token and add custom nginx access_token into the
request header
    access_by_lua_file /etc/nginx/api_conf.d/oauth/oauth_introspec.lua;

    mirror /_NULL;                   # Create a copy of the request to
capture request body
    client_body_in_single_buffer on;  # Minimize memory copy operations on
request body
    client_body_buffer_size      16k; # Largest body to keep in memory
(before writing to file)
    client_max_body_size         16k;

    # Policy configuration here (authentication, rate limiting, logging,
more...) 

    proxy_set_header X-Real-IP      $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header Host  $http_host;


    proxy_pass https://$upstream$request_uri;

}

}
Am not seeing any specific errors in nginx error log too, i can see the log
before proxy pass. added below line too

error_log  logs/error.log  debug;
Every alternate requests are getting 400 bad request. But constant interval
requests are getting success response and if i test with 2 requests per
second then it fails with this error. am out of options. Please help.



--
Sent from: http://nginx.2469901.n2.nabble.com/


More information about the nginx mailing list