Problem with accelerated Rails downloads with NGINX using X-Accel-Redirect header

Added by Djordjije Crni almost 7 years ago

Rails has an option to use X-Accel-Redirect. See more info:

When properly configured, file downloads will be served by Nginx directly.
There is one problem: if Redmine has been configured with mandatory authentication (without anonymous access), then it is necessary that user have to be logged in, in order to successfully download file from Redmine. If user is not logged in, file download will fail, and web browser be rerouted to incorrect login back_url, containing Nginx upstream URL.

How to avoid this problem?