位置指令中的重写条件被忽略

配置1:

  <Location "/tmp">
     RewriteEngine On
     RewriteCond %{HTTP:X-Version} !^(1.2)$
     RewriteRule ^ - [F]
  </Location>

配置2:

  <Location "/tmp/tmp1BFWBb">
     RewriteEngine On
     RewriteCond %{HTTP:X-Version} !^(1.2)$
     RewriteRule ^ - [F]
  </Location>

我想访问URL http://serverIp/tmp/tmp1BFWBb。另外,tmp/tmp1BFWBb是我要下载的实际文件。

我希望如果请求包含标头X-Version: 1.2,则请求应成功,否则应失败。

上面的configuration 1实现了我想要的,但是问题是我只想要tmp/tmp1BFWBb的此标头条件而不是tmp/*,这就是为什么我想做configuration 2但是当我使用configuration 2时,即使请求标头不包含X-Version或它的值是多少,文件仍会下载,访问不会被拒绝。

如果使用Directory而不是Location,也会发生同样的情况。 也是

 <Location "/tmp/tmp1BFWBb">
     Require all denied
     RewriteEngine On
     RewriteCond %{HTTP:X-Version} !^(1.2)$
     RewriteRule ^ - [F]
  </Location>

上面的配置确实拒绝对/tmp/tmp1BFWBb的请求,但允许所有其他/tmp/*

有帮助吗?

smazhe 回答:位置指令中的重写条件被忽略

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/2938190.html

大家都在问