$request_uri is a built-in variable of Nginx, which meaning is the pure uri in HTTP request line without any process.
For instance, if the HTTP request line is "GET /path/to//a.jpg HTTP/1.1", the $request_uri is "/path/to//a.jpg". But the $uri will be "/path/to/a.jpg" if merge_slashes is enable.
if the HTTP request line is "GET /path%2Fto/a.jpg HTTP1/1.", the $request_uri is "/path%2Fto/a.jpg". But the $uri will be "/path/to/a.jpg".