ProxyHTMLURLMap 在 apache2.4 中不起作用

Vin*_*ini 4 mod-rewrite reverse-proxy apache-2.2 apache-2.4

我在 ubuntu 14.04 上使用 apache2.4。我启用了 mod_proxy_html。但是我的 URL 没有被新的 URL 取代。我在 apache2.2 中做了同样的事情,它运行良好。这是我的虚拟主机文件。

<VirtualHost *:80>
ServerAdmin webmaster@example.com
ServerName www.example.com
ServerAlias example.com
DocumentRoot /var/www/html/www.example.com
LogLevel error
CustomLog /var/log/apache2/www.example.com_access.log combined
ErrorLog /var/log/apache2/www.example.com_error.log

#Proxy and cookies settings
ProxyPreserveHost On
ProxyPassReverse / http://www.example.com/example/control/
ProxyPassReverse / https://www.example.com/example/control/
ProxyPassReverse / /example/control/
ProxyPassReverseCookiePath /example /

    <Proxy balancer://cluster>
        BalancerMember ajp://10.14.78.45:8009 route=node01 keepalive=On loadfactor=1 ping=10 ttl=600
        ProxySet timeout=60 stickysession=JSESSIONID nofailover=On
    </Proxy>

RewriteEngine On

#redirect non www domain to www domain
RewriteCond %{HTTP_HOST} ^example.com$ [NC]
    RewriteRule ^(.*)$ http://www.example.com$1 [R=301,L]

#Website    
RewriteRule ^/;(.*)$ balancer://cluster/example/control/main;$1 [P,L]
RewriteRule ^/$ balancer://cluster/example/control/main [P,L]

SetOutputFilter INFLATE;proxy-html;DEFLATE
ProxyHTMLExtended Off
ProxyHTMLInterp On
ProxyHTMLDoctype XHTML Legacy
LogLevel debug

#Rewrite home page link
ProxyHTMLURLMap ^(.*)/example/control/main;(.*)$ $1/;$2 [R]
ProxyHTMLURLMap ^(.*)/example/control/main$ $1/ [R]
Run Code Online (Sandbox Code Playgroud)

我猜 ProxyHTMLURLMap 在这里不起作用。如果有什么配置不正确,请告诉我。

谢谢

Vin*_*ini 9

经过数小时的研究,我得到了简单的解决方案,但运气不佳。

proxy_html.conf 文件丢失。我已将此文件从 apache2.2 复制到 /etc/apache/mods-available 并在启用 mods 的链接中指向此文件。

vi /etc/apache2/mods-available
Run Code Online (Sandbox Code Playgroud)

添加了这些行:

# Here's the declaration for W3C HTML 4.01 and XHTML 1.0

ProxyHTMLLinks  a       href
ProxyHTMLLinks  area        href
ProxyHTMLLinks  link        href
ProxyHTMLLinks  img     src longdesc usemap
ProxyHTMLLinks  object      classid codebase data usemap
ProxyHTMLLinks  q       cite
ProxyHTMLLinks  blockquote  cite
ProxyHTMLLinks  ins     cite
ProxyHTMLLinks  del     cite
ProxyHTMLLinks  form        action
ProxyHTMLLinks  input       src usemap
ProxyHTMLLinks  head        profile
ProxyHTMLLinks  base        href
ProxyHTMLLinks  script      src for

# To support scripting events (with ProxyHTMLExtended On),
# you'll need to declare them too.

ProxyHTMLEvents onclick ondblclick onmousedown onmouseup \
        onmouseover onmousemove onmouseout onkeypress \
        onkeydown onkeyup onfocus onblur onload \
        onunload onsubmit onreset onselect onchange
Run Code Online (Sandbox Code Playgroud)

在启用 mods 的情况下创建链接

ln -s /etc/apache2/mods-available/proxy_html.conf /etc/apache2/mods-enabled/
Run Code Online (Sandbox Code Playgroud)

之后它完美地工作