Serve Up Pdf As A Download With Pyramid, Ningx, X-accel-redirect Header
I want a user to be able to click a link like this: download Have a Pyramid 1.2.7 app handle the view like this @view_config(route_name
Solution 1:
If you want to indicate that a web browser should download a resource rather than display it, try using the Content-Disposition
header as described in RFC 6266. For example, the following response header will tell the browser to download the file:
Content-Disposition: attachment
You can also specify a file name for the downloaded file through this header (if it differs from the last path component in the URL):
Content-Disposition: attachment; filename=foo.pdf
Looking at the Nginx documentation, this response header should work correctly in conjunction with the X-Accel-Redirect
feature you're using.
Post a Comment for "Serve Up Pdf As A Download With Pyramid, Ningx, X-accel-redirect Header"