FastDFS的作者介绍的防盗链 使用FastDFS的内置防盗链功能
2017-11-06 11:06
561 查看
FastDFS内置防盗链采用Token的方式。
token是带时效的,包含了文件ID、时间戳ts和密钥。
在设定的时间范围内,比如5分钟内,token是有效的。
FastDFS在URL中带上当前时间戳和带时效的token,参数名分别为ts和token。
FastDFS API中提供了生成token的算法,扩展模块中会对token进行检验。
token的生成和检验都在服务器端,因此不会存在安全问题。
链接示例:http://192.168.1.15:8080/group1/M01/01/01/wKgBD01c15nvKU1cAABAOeCdFS466570.c?token=b32cd06a53dea4376e43d71cc882f9cb&ts=1297930137
http.conf中防盗链相关的几个参数如下:
http.anti_steal.check_token:是否做token检查,缺省为false
http.anti_steal.token_ttl:token TTL,即生成token的有效时长
http.anti_steal.secret_key:生成token的密钥,尽量设置得长一些,千万不要泄露出去
http.anti_steal.token_check_fail:token检查失败,返回的文件内容,需指定本地文件名
配置示例如下:
# if use token to anti-steal
# default value is false (0)
http.anti_steal.check_token=false
# token TTL (time to live), seconds
# default value is 600
http.anti_steal.token_ttl=900
# secret key to generate anti-steal token
# this parameter must be set when http.anti_steal.check_token set to true
# the length of the secret key should not exceed 128 bytes
http.anti_steal.secret_key=FastDFS1234567890
# return the content of the file when check token fail
# default value is empty (no file sepecified)
http.anti_steal.token_check_fail=/home/yuqing/fastdfs/conf/anti-steal.jpg
http://bbs.chinaunix.net/thread-1916999-1-1.html
相关文章推荐
- 使用FastDFS的内置防盗链功能
- 关于Apache mod_rewrite的中文配置、使用和语法介绍(实现URL重写和防盗链功能)
- 关于Apache mod_rewrite的中文配置、使用和语法介绍(实现URL重写和防盗链功能)
- 关于Apache mod_rewrite的中文配置、使用和语法介绍(实现URL重写和防盗链功能)
- 关于Apache mod_rewrite的中文配置、使用和语法介绍(实现URL重写和防盗链功能
- 关于Apache mod_rewrite的中文配置、使用和语法介绍(实现URL重写和防盗链功能)
- 如何使用来自 Rich Edit(CRichEditCtrl) 控件的内置打印功能
- 利用Windows内置功能轻松查看端口使用情况
- GCC 使用手册和常用功能介绍
- SQL2000系统表、存储过程、函数的功能介绍及应用2009年01月21日 星期三 11:38虽然使用系统存储过程、系统函数与信息架构视图已经可以为我们提供了相当丰富的元数据信息,但是对于某些特殊的元数据信息,我们仍然需要直接对系统表进行查询。因为SQL
- Oracle Audit 功能的使用方法介绍
- 使用IIS内置压缩功能,增加网站访问速度
- [EntLib]微软企业库5.0 学习之路——第五步、介绍EntLib.Validation模块信息、验证器的实现层级及内置的各种验证器的使用方法——上篇
- [使用心得]maven2之m2eclipse使用手册之二m2eclipse功能介绍
- 微软企业库5.0 学习之路——第五步、介绍EntLib.Validation模块信息、验证器的实现层级及内置的各种验证器的使用方法——上篇
- 微软企业库5.0 学习之路——第五步、介绍EntLib.Validation模块信息、验证器的实现层级及内置的各种验证器的使用方法——中篇
- 使用RegularExpressionValidator验证控件时的验证功能及其验证表达式介绍
- document.designMode的功能与使用方法介绍
- document.designMode的功能与使用方法介绍
- SQL Artisan 1.3功能使用介绍