When selecting the "Default download method" to "Private local files served by Drupal" my images won't work anymore.

Using the public method the "imagecached" image on admin/config/media/image-styles/edit/thumbnail shows as expected, but when switched to 'private' this image won't show - The URL of the image gets in a redirect-loop to itself.

The configuration of the Nginx virtual host can be found on https://gist.github.com/antichaos/a40d13b43e25b695b2b0

Probably I am overlooking an obvious mistake in the nginx-config - but until now I didn't find it...

Comments

Barry_Fisher’s picture

I know this is an old thread, but for posterity to help my future self and anyone else looking for a solution:

I had to add the following section to my nginx site configuration:

# Rewrite private file paths to @rewrite - i.e. index.php.
location ~ ^/system/files {
  try_files $uri @rewrite;
}

This intercepts any requests starting with /system/files (which is Drupal's internal callback for checking access to private files) and routes the request through Drupal's index page.

For completeness, If you don't already have the @rewrite directive elsewhere in your file, mine looks like: 

location @rewrite {
  rewrite ^ /index.php last;
}

--
Barry Fisher

Pivale