![OHS 和 ProxyPass 以及 RewriteRule / RedirectMatch](https://linux22.com/image/793626/OHS%20%E5%92%8C%20ProxyPass%20%E4%BB%A5%E5%8F%8A%20RewriteRule%20%2F%20RedirectMatch.png)
我已经设置了这个虚拟主机,
<VirtualHost *:443>
ServerName test.domain.org
DocumentRoot "/u02/config/www/tst-12c"
RewriteEngine on
RewriteCond %{REQUEST_METHOD} ^(OPTIONS)
RewriteRule .* - [F]
RewriteEngine On
RedirectMatch ^/ui/#/project/([^/]+)$ /ui-v2/#/project/$1
# SSL Engine Switch:
# Enable/Disable SSL for this virtual host.
SSLEngine on
<FilesMatch "\.(cgi|shtml|phtml|php)$">
SSLOptions +StdEnvVars
</FilesMatch>
<Directory "${ORACLE_INSTANCE}/config/fmwconfig/components/${COMPONENT_TYPE}/instances/${COMPONENT_NAME}/cgi-bin">
SSLOptions +StdEnvVars
</Directory>
<Directory "/u02/config/www/tst-12c/">
Options Indexes FollowSymLinks
AllowOverride ALL
Require all granted
</Directory>
BrowserMatch "MSIE [2-5]" \
nokeepalive ssl-unclean-shutdown \
downgrade-1.0 force-response-1.0
<Proxy "balancer://api_cluster">
BalancerMember "http://realbackend_server1:9006/api"
BalancerMember "http://realbackend_server1:9006/api"
</Proxy>
ProxyPass "/api" "balancer://api_cluster"
ProxyTimeout 240
但是 RedirectMatch 规则不起作用,我启用了调试模式,我看到所有内容都被重定向到 RedirectMatch 进行比较的 /api。
在调试文件中我看到如下消息:
AH00947:将 /api/virtualassistant/RG1080A-02 连接到realbackend_server1:9006, 引荐来源https://test.domain.org/ui/
RewriteCond: 输入 = '/api/virtualassistant/RG1080A-02' 模式 = '^/ui/#/project/([^/]+)' [NC] => 不匹配,引用者https://test.domain.org/ui/
这意味着 RedirectMatch 正在工作,但是在 ProxyPass 完成后执行,而不是之前。我也尝试过 RewriteRule,但它也是一样。
任何线索为什么会发生这种情况以及我该如何解决它?
问候