【问题标题】:Restrict acces to index.html and no other files in http server限制访问 index.html 和 http 服务器中的其他文件
【发布时间】:2020-07-08 09:58:42
【问题描述】:

我有一个使用lighttpd 运行的http 服务器(例如http://www.web.com)。构成此服务器的文件例如:

index.html
files/img1.png
files/img2.png

如果有人访问http://www.web.com/files/img1.png,他们可以看到该文件。有没有办法阻止这种类型的访问我的服务器? 我希望只有在用户从index.html 重定向或在其中使用时才能访问文件。

【问题讨论】:

    标签: http lighttpd


    【解决方案1】:

    听起来您正在尝试防止热链接或深度链接。 威慑是要求请求设置Referer标头,尽管某些浏览器或代理会去除Referer标头。

    $HTTP["url"] != "/index.html" {
        $HTTP["referer"] != "https://www.my-site.net/index.html" {
            url.access-deny = ( "" )
        }
    }
    

    这只是一种威慑。也可以看看: Can I rely on Referer HTTP header?

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-09-26
      • 1970-01-01
      • 1970-01-01
      • 2021-02-05
      • 1970-01-01
      • 1970-01-01
      • 2014-10-23
      • 2019-01-09
      相关资源
      最近更新 更多