【发布时间】:2019-04-02 21:30:54
【问题描述】:
我有一个网址 www.example.com。 这应该指向页面
www.data.city.author/blah/blah/fjfjf/fkkeklf/eied/shudfj
并在
中显示内容www.data.city.author/blah/blah/fjfjf/fkkeklf/eied/shudfj
但在地址框中,应该显示www.example.com
我在 vhost.conf 中对代理的当前配置是:
SSLProxyEngine on
Proxypass "/" www.data.city.author/blah/blah/fjfjf/fkkeklf/eied/shudfj
ProxyPassReverse "/" www.data.city.author/blah/blah/fjfjf/fkkeklf/eied/shudfj
问题是 Apache 2.4 有一个错误,即当使用ProxyPass 时,URL 不应超过 96 个字符。因此,它将 URL 截断为 96 个字符,因此配置返回错误消息。
任何其他方式来解决我的情况。我尝试使用带有 [P] 标志的 apache RewriteRule,但它不适用于我的情况。
编辑
以下是我目前的配置
<VirtualHost *:11080>
ServerAdmin webmaster@dummy-host.example.com
ServerName int.chicagomeningvax.org
ServerAlias www.int.chicagomeningvax.org
DocumentRoot "/app/web-vhosts"
ErrorLog "/app/apache-vhosts/logs/error_log"
CustomLog "/app/apache-vhosts/logs/access_log" combined env=!dontlog
RewriteEngine on
RewriteRule / https://data.cityofchicago.org/Health-Human-Services/Meningitis-Vaccine-Locations-Map-Visualization/n4bi-r8ij [R=302,P]
</VirtualHost>
【问题讨论】:
-
仅供参考:这不是重定向,而是代理(在您的问题中修改)。你说
RewriteRule没用。为什么?显示您使用的配置。因为除了ProxyPass和RewriteRule之外,没有办法做代理。看了bug报告,还是没有修复,解决方法是RewriteRule。 -
RewriteEngine on RewriteRule / data.cityofchicago.org/Health-Human-Services/… [R=302,L,P]
-
Apache 2 中一个长期存在的错误:bz.apache.org/bugzilla/show_bug.cgi?id=53218
标签: apache mod-rewrite reverse-proxy vhosts proxypass