Apache 配置限制请求中包含特定字符串的请求 URL
Apache configurations to restrict requests with specific string in request URL
我在 Apache 上配置了一个 URL。这里是配置
<VirtualHost 192.168.1.82:443>
ServerName test.ex.com
Header always set Strict-transport-Security "max-age=63072000; includeSubDomain; preload"
Header always append X-Frame-Options SAMEORIGIN
Header set X-XSS-Protection: "1; mode=block"
ProxyRequests On
ProxyPass /cong http://192.168.4.185:8081/cong
ProxyPassReverse /cong http://192.168.4.185:8081/cong
ErrorLog logs/test.ex.com-error_log
CustomLog logs/test.ex.com-access_log common
SSLEngine on
SSLCertificateFile /etc/httpd/*.ex.com/36287365__.ex.com.cert
SSLCertificateKeyFile /etc/httpd/*.ex.com/36287365__.ex.com.key
Header add P3P "CP=\"NOI DSP COR CURa ADMa DEVa OUR IND OTC\""
</VirtualHost>
通过以上配置,我允许所有请求到达 https://test.ex.com/cong/. I want to restrict some specific request comes with string "getUserPattern" in request string like https://test.ex.com/cong/module/getUserPattern/final
尝试使用 ProxyBlock getUserPattern
但没有成功。是否有任何 way/configuration 仅在 apache 级别限制此类 URL 或重定向到 https://test.ex.com/cong.
首先,您可能想要禁用转发(标准)代理请求(将 ProxyRequests
设置为 Off
不会禁用 ProxyPass
指令的使用:
ProxyRequests Off
如果您想将任何包含 getUserPattern
的请求重定向到 https://test.ex.com/cong
,请在您当前的 ProxyPass 规则之上添加这两个指令:
RedirectMatch "getUserPattern" "https://test.ex.com/cong"
ProxyPassMatch "getUserPattern" !
我在 Apache 上配置了一个 URL。这里是配置
<VirtualHost 192.168.1.82:443>
ServerName test.ex.com
Header always set Strict-transport-Security "max-age=63072000; includeSubDomain; preload"
Header always append X-Frame-Options SAMEORIGIN
Header set X-XSS-Protection: "1; mode=block"
ProxyRequests On
ProxyPass /cong http://192.168.4.185:8081/cong
ProxyPassReverse /cong http://192.168.4.185:8081/cong
ErrorLog logs/test.ex.com-error_log
CustomLog logs/test.ex.com-access_log common
SSLEngine on
SSLCertificateFile /etc/httpd/*.ex.com/36287365__.ex.com.cert
SSLCertificateKeyFile /etc/httpd/*.ex.com/36287365__.ex.com.key
Header add P3P "CP=\"NOI DSP COR CURa ADMa DEVa OUR IND OTC\""
</VirtualHost>
通过以上配置,我允许所有请求到达 https://test.ex.com/cong/. I want to restrict some specific request comes with string "getUserPattern" in request string like https://test.ex.com/cong/module/getUserPattern/final
尝试使用 ProxyBlock getUserPattern
但没有成功。是否有任何 way/configuration 仅在 apache 级别限制此类 URL 或重定向到 https://test.ex.com/cong.
首先,您可能想要禁用转发(标准)代理请求(将 ProxyRequests
设置为 Off
不会禁用 ProxyPass
指令的使用:
ProxyRequests Off
如果您想将任何包含 getUserPattern
的请求重定向到 https://test.ex.com/cong
,请在您当前的 ProxyPass 规则之上添加这两个指令:
RedirectMatch "getUserPattern" "https://test.ex.com/cong"
ProxyPassMatch "getUserPattern" !