By now, nginx does not allow urlencoded X-Accel-Redirect URLs and totally fails to access files with '?' in name with it. The problem was also discussed at 'nginx' maillist: http://nginx.2469901.n2.nabble.com/Bug-X-Accel-Redirect-td5510716.html
The patch suggested there just unescaped the url in ngx_http_parse_unsafe_uri(). As Maxim Dounin said, this is incorrect because also unescapes the query string. I want to suggest another solution - swap ngx_http_parse_unsafe_uri() to ngx_http_parse_complex_uri(). The patch is in attachment. What can you say about it?