我有一个托管在 Firebase 上的网站,使用静态 html,没有使用服务器端函数来传递结果。
运行时curl -X PURGE https://mywebsite.com -v -L结果是:
{ "status": "ok", "id": "20755-1619059392-3560756" }
Run Code Online (Sandbox Code Playgroud)
我需要一种方法来将此操作限制为特定 IP,这样任何人都无法重置我的缓存,这可能会导致额外的费用。
另外,Firebase 似乎使用 Varnish 来管理缓存(这是空的)。
我客户的安全顾问向我们发送了有关如何处理此问题的建议,我不确定这到底是 .htaccess 语法还是什么:
# Varnish recommends to using PURGE method only by valid user,
# for example by ip limiting and for other return 405 Not allowed:
acl purge {
"localhost";
"192.168.55.0"/24;
}
sub vcl_recv {
# allow PURGE from localhost and 192.168.55...
if (req.method == "PURGE") {
if (!client.ip ~ purge) {
return(synth(405,"Not allowed."));
} …Run Code Online (Sandbox Code Playgroud)