we did't use windows paths in the case 
location means part of URI in nginx internal redirect via X-Accel-Redirect

I could be suggesting that follow code it a little bit better:
$headers['X-Accel-Redirect'] = $location . '/' . ltrim($filename,'/');