Apache LocationMatch 匹配組並在標頭中使用

Apache LocationMatch 匹配組並在標頭中使用

我正在嘗試從 URL 獲取模式,並在標頭中使用它。

就像是

<LocationMatch "^/static/(?<sitename>[^/]+)">
 Header set Content-Security-Policy-Report-Only "frame-ancestors 'none'; report-uri https://csp-reporter.com/%{env:MATCH_SITENAME}"
</LocationMatch>

據記錄這裡

我收到錯誤

AH00526: Syntax error on line XXX of XXX/httpd.conf:
Unrecognized header format %

我們使用的是 Apache 2.4.46

知道出了什麼問題嗎?

答案1

如果我沒記錯的話,我有一個類似的錯誤,那是因為我忘了always...標題總是設定 Content-Security-Policy-Report-Only“frame-ancestors...

相關內容