António, this was a really good idea, but with fastcgi_intercept_errors and proxy_intercept_errors turned on, the $orig_uri is logged as whatever the error_page is (in my case /error.html). Posted at Nginx Forum: http://forum.nginx.org/read.php?2,227612,228168#msg-228168