Lighttpd服务器,如何添加header头,禁止浏览器在线打开文件或播放视频,强制下载文件

  • A+
所属分类:Lighttpd

强制要求所有文件直接下载,禁止在线打开

$HTTP["url"] =~ "^/downloads/.*" {
    setenv.add-response-header = ( "Content-Disposition" => "attachment" )
}

指定某个文件直接下载,不在线打开

$HTTP["url"] =~ "/awesome.png$" {
    setenv.add-response-header = ( "Content-Disposition" => "attachment; filename=\"happy.png\"")
}

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: