Developer
System Administrator
Jahia 7.3
Jahia 8
Legacy
Add http header to requests
Question
How to add http header in http response when a user download a file
Answer
This can be done with a rewrite rule. For example, the following rule would add the header X-Robots-Tag to any url matching pdf
<rule> <name>Set header for pdf files</name> <note>rule to set noindex</note> <from>^(.*)(pdf)$</from> <set type="response-header" name="X-Robots-Tag">noindex</set> </rule>
The rule can be customized to work with files of other types, or files from a specific site or path.