User Tools

Site Tools


lighttpd force pdf download

In lighttpd, to disable PDF opening in browser, add following config files in lighttpd.conf. This is useful in increasing CTR as browsers usually get stuck while loading PDF files.

$HTTP["url"] =~ "(.*)\.pdf" {
mimetype.assign = (".pdf" =>"application/octet-stream")
setenv.add-response-header = ( "Content-Disposition" => "attachment" )

Dont forget to enable setenv module, if not already done …

server.modules += ( "mod_setenv" )
service lighttpd reload

Tested on

See also


wiki/lighttpd_force_pdf_download.txt · Last modified: 2022/10/03 12:09 by antisa

Except where otherwise noted, content on this wiki is licensed under the following license: CC0 1.0 Universal
CC0 1.0 Universal Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki