I have PDF files in the public rails folder. I want to set the response header of "content-disposition" to "attachment". I know that I can create a controller for reading files and configure the header myself, but is there any general general application parameter that I can enable / configure?
Thanks in advance.
-JP
Rails / Rack never sees requests for your shared folder, your front-end web server should handle them. Assuming you are using Apache, you can use this approach .
, .
cwninja.
, Apache :
<FilesMatch "\.(?i:pdf)$"> ForceType application/octet-stream Header set Content-Disposition attachment </FilesMatch>
application/octet-stream, application/pdf IE.
application/octet-stream
application/pdf
Source: https://habr.com/ru/post/1721126/More articles:How to distribute variable sized structures in memory? - c ++Subversion Automation with C # - c #template fragment caching doesn't seem to work for some custom template tags - pythonHow to configure maven for two separate projects that depend on the same jar - javaReplacing an Xcode Preprocessor with a User Process - preprocessorC # - How to deal with 2 "TopMost" forms? - c #Do these regular calls to the Perl routines? - methods.Net Apple Push Notification Service Provider? - pushIs there a convenient way for an alias to only have conflicting columns when joining tables in SQLAlchemy? - pythonSave data via web service using NHibernate? - web-servicesAll Articles