I'm attempting to display uploaded pdf files via a controller method
class DocumentsController < ApplicationController
def show
response.headers['X-Sendfile-Type'] = "X-Sendfile"
send_file(@document.file.path, filename: @document.file.name, type: "application/pdf", disposition: :inline)
end
end
This works fine locally, but on heroku I get the inexplicit application error with no further stack trace
at=info method=GET path="/documents/21" host=myapp.herokuapp.com request_id=754f6d15-cb06-43a1-aa3c-308e5308b54e fwd="76.21.40.212" dyno=web.1 connect=29ms service=27ms status=500 bytes=1543
I've tried setting config.action_dispatch.x_sendfile_header = "X-Sendfile"
in config/environments/production.rb but this causes all the assets on the application to not be loaded in production.
What am I missing?