防盗链

防盗链可以防止您存储在COS的资源被其他网站盗用。您可在【Bucket管理】页面,点击桶对应的【设置】按钮,进入桶属性设置页面。点击【防盗链设置】,如下图所示:

www.84805.com

说明:

  • 防盗链的配置支持 * 和 ? 通配符,分别表示一组字符和一个字符;
  • 是否允许空referer表示当请求的Referer头为空时,是否允许访问,该配置只有referer白名单不为空时才有效;

例子

按照以上的配置方式,可以进行简单的验证确认配置是否生效,如下:

cos@macbook ~$ curl -I -H "Referer:http://image.victor.com/" http://example2.cos-cn-suzhou.chinac.com/image.jpg
HTTP/1.1 200 OK
Server: openresty/1.9.3.2
Date: Fri, 17 Jun 2016 04:04:20 GMT
Content-Type: image/jpeg
Content-Length: 101747
Connection: keep-alive
x-cos-request-id: c12f90420a0a000001555c87ef02640d
ETag: "e2be8e1cab3113771b284e43ccea8f47"
Last-Modified: Fri, 17 Jun 2016 04:02:59 GMT
cos@macbook ~$ curl -I -H "Referer:http://image.victor.xxx/" http://example2.cos-cn-suzhou.chinac.com/image.jpg
HTTP/1.1 403 Forbidden
Server: openresty/1.9.3.2
Date: Fri, 17 Jun 2016 04:04:32 GMT
Content-Type: text/html
Content-Length: 174
Connection: keep-alive

results matching ""

    No results matching "_www.84805.com_澳门永利304.com"_www.84805.com_澳门永利304.com