Nginx Upstream returning 400 Bad Request if null character is being passed
in the request as part of uri or query params.

Is there a way Null Character can be removed from request before proxying 
it to upstream.

Its only known from access logs that null character is being passed in
request as \x00 and causing the failure

How to identify the Null Character and remove it ? 

Tried below options but its not able to identify the null character

if ($args ~* (.*)(\x00)(.*)) {
     set $args $1$3;
}


Nginx returning below error 

Error Log

2020/06/25 20:20:43 [info] 19838#19838: *11985 client sent invalid request
while reading client request line, client: 10.49.120.61, server: test.com,
request: "HEAD /folder/Test.m3u8?uid=abc123 HTTP/1.0"


Access log

 10.49.120.61 | - | test.com | [25/Jun/2020:20:20:43 +0530] | - | "HEAD
/folder/Test.m3u8?uid=abc123\x00 HTTP/1.0" | 400 | 0 | "-" | "-" | 0.001 | -
| - | - | "- - - -" | http | - | -| "-"

Posted at Nginx Forum: 
https://forum.nginx.org/read.php?2,288455,288455#msg-288455

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx

Reply via email to