I am using apache2.4 on ubuntu 14.04. And I have enabled mod_proxy_html.But my URL are not getting replaced by a new one. Same thing I did in apache2.2 and it was working perfectly. This is my Virtual host file.

<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:// route=node01 keepalive=On loadfactor=1 ping=10 ttl=600
        ProxySet timeout=60 stickysession=JSESSIONID nofailover=On

RewriteEngine On

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

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]

I guess ProxyHTMLURLMap is not working here. Please let me know if something is not configured properly.



After hours of research I got simple solution with little luck.

proxy_html.conf file was missing. I have copied this file from apache2.2 to /etc/apache/mods-available and made link in mods-enabled pointing to this file.

vi /etc/apache2/mods-available

added these lines:

# 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

creating link in mods-enabled

ln -s /etc/apache2/mods-available/proxy_html.conf /etc/apache2/mods-enabled/

After that it worked perfectly

  • 1
    Oh wow, the config file was indeed missing in Ubuntu 14.04 LTS. I wish I had discovered this a few hours ago. – Martin Feb 4 '16 at 12:30
  • See this similar answer: stackoverflow.com/questions/32340737/… – BuvinJ Jul 15 '18 at 19:15
  • would just "ProxyRequests off" solve this? – Orphans Apr 7 at 13:11
  • @Orphans I tried it with ProxyRequests off and it didn't work – kiltek May 14 at 11:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.