In a Rails app I’m working on, there is a model that can have attachments and the paperclip gem is used to handle this. However, these files need to only be available to logged in users. They cannot be directly accessible to the public. For this, I used nginx’s X-Accel-Redirect response header. But, I couldn’t get it to work!