Keep Server Online
  
If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.
  
or
  
 
  
A donation makes a contribution towards the costs, the time and effort that's going in this site and building.
  
Thank You! Steffen
  
Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
 |    |   
 | 
     Topic: mod_proxy_html tag mangling | 
 |   
| Author | 
  | 
 
pshenkyr
 
 
  Joined: 13 Dec 2007 Posts: 2 Location: Washington, DC
  | 
 Posted: Thu 13 Dec '07 22:05    Post subject: mod_proxy_html tag mangling | 
     | 
 
  | 
 
Hello,
 
 
Basics first, this installation is on windows 2000,with one server running apache 2.2.6 from apachelounge with the mod_proxy_html-3.0.0 from apachelounge as a reverse proxy to jboss 4.2.2.  Everything installs and activates properly, the application works properly when accessing the jboss server directly.  I'm using tcpmon from https://tcpmon.dev.java.net/ to capture datastreams.
 
 
The issue crops up when accessing the application through the reverse proxy with   SetOutputFilter   proxy-html   active.
 
 
Configuration snippet:
 
<VirtualHost _default_:8080>
 
    DocumentRoot  "C:\valid\path\to\placeholder\docroot"
 
    ServerName    host1.domain.tld:8080
 
    ErrorLog      logs/xxxxxxxxx.log
 
    LogLevel      Debug
 
    
 
    ProxyRequests off
 
    <Proxy *>
 
        Order deny,allow
 
        Allow from all
 
    </Proxy>
 
    ProxyPass            /fake   http://host2.domain.tld:8080/real
 
    ProxyPassReverse     /fake   http://host2.domain.tld:8080/real
 
    SetOutputFilter      proxy-html
 
    ProxyHTMLLogVerbose  On
 
    ProxyHTMLDoctype     HTML Legacy
 
    ProxyHTMLBufSize     65536
 
    ProxyHTMLURLMap      /real/  /fake/
 
    <Location /fake>
 
        Order deny,allow
 
        Allow from all
 
    </Location>
 
    CacheRoot C:\valid\path\to\cache
 
</VirtualHost>
 
 
The raw source:
 
<custom:link page="/viewSomethingInteresting.action?new" title="Search Something" prefix="<li>" postfix="">Something</custom:link>
 
 
The stream to the browser without proxy-html:
 
<a href="/real/viewSomethingInteresting.action?new" title="Search Something">Something</a>
 
 
The stream to the browser with proxy-html active:
 
<a href="/fake/viewSomethingInteresting.action?new" title="Search Something"></a>Something
 
 
So, if it is not obvious, the effect is to create an inactive link from a functioning one by swapping the sequence of Something and </a>.
 
 
I have tried several combinations of /real and /fake to no avail.
 
This happens to several different lines, the one included is only one instance.
 
I have tried seperating the lines and stringing them together to no avail.
 
 
I'll be glad to be called a n00b for some easy Doh! configuration issue but I can't see it.  I believe if this is cleared up the reverse proxy will function properly with both static and dynamic content for this application.
 
 
My thanks in advance for any assistance. | 
 
  | 
 
| Back to top | 
 | 
 
pshenkyr
 
 
  Joined: 13 Dec 2007 Posts: 2 Location: Washington, DC
  | 
 Posted: Mon 10 Mar '08 17:22    Post subject: Problem found | 
     | 
 
  | 
 
This was a ~5yo application migrated to newer deployment components.  One of these was upgrading Struts from v1.0.1 to v1.2.9, with the application including some custom tag libraries.  As a result the text sent into mod_proxy_html included an incorrect self closing tag so the example listed as (v1.0.1): 
 
<a href="/real/viewSomethingInteresting.action?new" title="Search Something">Something</a>
 
 
became (v1.2.9): 
 
<a href="/real/viewSomethingInteresting.action?new" title="Search Something"/>Something</a>
 
 
The cause was a bug in a custom tag which was ignored/handled by Struts v1.0.1 but not by v1.2.9.  The invalid result was being corrected by quirks mode in browsers, but was confusing mod_proxy_html into generating the invalid links.
 
 
Once the custom tag was corrected, mod_proxy_html worked properly.
 
 
Thanks to anyone who spent brain cells on this. | 
 
  | 
 
| Back to top | 
 | 
 
 
 
 
 | 
 
 
 |  
 
 |  
  |   
 |