Apache:除特定的POST请求外,需要基本的身份validation

(RHEL 6.2,Apache 2.2.1)

我试图让一个LAMP网站运行在基本的身份validation,以防止一般的访问(这是一个网站仍在生产testing环境),我遇到了一个问题,多个file uploadfunction失败,因为它没有正确处理authentication; 我可以看到在Apache日志中,authentication被放弃了POST

10.77.34.123 - testuser [14/Mar/2012:14:10:13 +1100] "GET /index.php/tools/required/files/import?ocID=&searchInstance=file1331694544 HTTP/1.1" 200 8558 10.77.34.123 - testuser [14/Mar/2012:14:10:13 +1100] "GET /concrete/js/swfupload/swfupload.js?_=1331694608575 HTTP/1.1" 200 36807 10.77.34.123 - testuser [14/Mar/2012:14:10:13 +1100] "GET /concrete/js/swfupload/swfupload.handlers.js?_=1331694608601 HTTP/1.1" 200 6443 10.77.34.123 - testuser [14/Mar/2012:14:10:13 +1100] "GET /concrete/js/swfupload/swfupload.fileprogress.js?_=1331694608621 HTTP/1.1" 200 7529 10.77.34.123 - testuser [14/Mar/2012:14:10:13 +1100] "GET /concrete/js/swfupload/swfupload.queue.js?_=1331694608636 HTTP/1.1" 200 3479 10.77.34.123 - testuser [14/Mar/2012:14:10:14 +1100] "GET /concrete/flash/swfupload/swfupload.swf?preventswfcaching=1331694608650 HTTP/1.1" 200 12419 10.77.34.123 - - [14/Mar/2012:14:10:20 +1100] "POST /index.php/tools/required/files/importers/multiple HTTP/1.1" 401 488 

作为一个非常快速的解决scheme,我将Apacheconfiguration更改为只需要GET请求的authenticate,而不是POST,但是从安全angular度来看,这并不是理想的。 目前的Apache指令是:

 <Directory /> AuthName "Priceline Portal Dev" AuthUserFile /home/dev_priceline/passwords <Limit GET> AuthType Basic Require valid-user </Limit> </Directory> 

这需要基本身份validation来访问网站(通过GET),但允许POSTs通过。

我想要做的就是改变它:在URL中包含“多个”的POST请求不需要authentication所有其他的请求需要基本的authentication。

有没有办法使用Apache指令来做到这一点? 多个上传function内置于正在使用的CMS中,基本身份validation将不会用于最终生产,所以我不想更改上传代码本身。

那么,这很丑陋..

 <Directory /> AuthName "Priceline Portal Dev" AuthUserFile /home/dev_priceline/passwords AuthType Basic Require valid-user </Directory> <LocationMatch .*/multiple$> <Limit POST> Satisfy Any </Limit> </LocationMatch> 

所以,只要允许auth规则被忽略(假设主机被Allow / Deny规则Allow ),只用于以/multiple结尾的POST请求,就像日志中那样。 那声音怎么样?