我正在使用mod安全性來查找post參數中的特定值,並在重複進來時阻止請求。我正在使用mod安全用戶集合來完成此操作。問題是我的請求長時間運行,因此一個請求可能需要超過5分鐘。我假設的用戶集合在第一個請求得到處理之前不會寫入磁盤。如果在執行第一個請求期間另一個請求使用post參數的重複值,則第二個請求不會被阻止,因爲集合尚不可用。我需要避免這種情況。我可以使用mod安全性中的請求使用基於內存的共享集合嗎?任何其他方式?下面的代碼片段:使用mod安全阻止重複http請求
SecRule ARGS_NAMES "uploadfilename" "id:400000,phase:2,nolog,setuid:%{ARGS.uploadfilename},initcol:USER=%{ARGS.uploadfilename},setvar:USER.duplicaterequests=+1,expirevar:USER.duplicaterequests=3600"
SecRule USER:duplicaterequests "@gt 1" "id:400001,phase:2,deny,status:409,msg:'Duplicate Request!'"
ErrorDocument 409 "<h1>Duplicate request!</h1><p>Looks like this is a duplicate request, if this is not on purpose, your original request is most likely still being processed. If this is on purpose, you'll need to go back, refresh the page, and re-submit the data."