You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Pongtawat Chippimolchai <po...@gmail.com> on 2010/02/08 11:50:37 UTC

[users@httpd] Reverse Proxy incorrectly transform content

Hello,

I'm using Apache to redirect request via reverse proxy to Tomcat on port
8080. On most of the pages, it will work flawlessly. However, on some pages,
it seems that Apache will incorrectly modify the HTML content (IMO, as part
of URL transformation). For example the following code:

<span class="blog-category-level"><a
href="/Blog/CategoryRss?xpage=plain&amp;category=Blog.News" title="RSS">

becomes:

<span class="blog-category-level"><a href="<span class="wikiexternallink"><a
class="wikimodel-freestanding" href="
http://wiki.knowledgesharing.in.th/Blog/CategoryRss?xpage=plain&amp;amp;category=Blog.News"><span
class="wikigeneratedlinkcontent">
http://wiki.knowledgesharing.in.th/Blog/CategoryRss?xpage=plain&amp;amp;category=Blog.News</span></a></span>"
title="RSS">

with a mysterious span code inside href attribute.

FYI, the original HTML validated as XHTML 1.0 Strict.

I have no idea what cause this. Please help.

My setting is as follow.

Apache version:
I have this issue with Apache on both Ubuntu 8.04 and 9.10, i.e. the
following versions:

Server version: Apache/2.2.8 (Ubuntu)
Server built:   Nov 13 2009 21:58:02

Server version: Apache/2.2.12 (Ubuntu)
Server built:   Nov 12 2009 22:51:51

The reverse proxy is configured as follow:

<VirtualHost *:80>
ServerName wiki.knowledgesharing.in.th
ServerAdmin "admin AT knowledgesharing DOT in DOT th"
ServerSignature Email

ProxyPass / http://wiki.knowledgesharing.in.th:8080/
ProxyPassReverse / http://wiki.knowledgesharing.in.th:8080/

<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
</VirtualHost>

The site is live, so you could try it at:

http://wiki.knowledgesharing.in.th/Blog/ (via Apache reverse proxy)
http://wiki.knowledgesharing.in.th:8080/Blog/ (direct to Tomcat, without
reverse proxy)

Thank you very much,
Pongtawat

Re: [users@httpd] Reverse Proxy incorrectly transform content

Posted by Devraj Mukherjee <de...@gmail.com>.
Hi Pongtawat,

We have worked on a similar issue with the Pentaho business
intelligence suite. If you are using Apache 2.2 + You can use
mob_substitute and have rules that change the domain name and fix
these issues.

I believe these issues are caused by dynamically generated URLs via
JavaScript etc.

Happy to share my configuration. Hope this helps.

On Tue, Feb 9, 2010 at 3:20 PM, Pongtawat Chippimolchai
<po...@gmail.com> wrote:
> Dear Tom,
> Thank you very much for clarifying this. That explains why it work correctly
> if I save the page as HTML and let Tomcat serve it statically behind Apache
> reverse proxy. So, there must be something wrong with XWiki apps when
> working behind Apache. I have checked the request that was send to Tomcat
> and it seems ok. So, it might be something in the header or environment?
> Thank you,
> Pongtawat
>
> On Mon, Feb 8, 2010 at 6:35 PM, Tom Evans <te...@googlemail.com> wrote:
>>
>> On Mon, Feb 8, 2010 at 10:50 AM, Pongtawat Chippimolchai
>> <po...@gmail.com> wrote:
>> > Hello,
>> > I'm using Apache to redirect request via reverse proxy to Tomcat on port
>> > 8080. On most of the pages, it will work flawlessly. However, on some
>> > pages,
>> > it seems that Apache will incorrectly modify the HTML content (IMO, as
>> > part
>> > of URL transformation). For example the following code:
>> > <span class="blog-category-level"><a
>> > href="/Blog/CategoryRss?xpage=plain&amp;category=Blog.News" title="RSS">
>> > becomes:
>> > <span class="blog-category-level"><a href="<span
>> > class="wikiexternallink"><a
>> > class="wikimodel-freestanding"
>> >
>> > href="http://wiki.knowledgesharing.in.th/Blog/CategoryRss?xpage=plain&amp;amp;category=Blog.News"><span
>> >
>> > class="wikigeneratedlinkcontent">http://wiki.knowledgesharing.in.th/Blog/CategoryRss?xpage=plain&amp;amp;category=Blog.News</span></a></span>"
>> > title="RSS">
>> > with a mysterious span code inside href attribute.
>> > FYI, the original HTML validated as XHTML 1.0 Strict.
>> > I have no idea what cause this. Please help.
>> > My setting is as follow.
>> > Apache version:
>> > I have this issue with Apache on both Ubuntu 8.04 and 9.10, i.e. the
>> > following versions:
>> > Server version: Apache/2.2.8 (Ubuntu)
>> > Server built:   Nov 13 2009 21:58:02
>> > Server version: Apache/2.2.12 (Ubuntu)
>> > Server built:   Nov 12 2009 22:51:51
>> > The reverse proxy is configured as follow:
>> > <VirtualHost *:80>
>> > ServerName wiki.knowledgesharing.in.th
>> > ServerAdmin "admin AT knowledgesharing DOT in DOT th"
>> > ServerSignature Email
>> > ProxyPass / http://wiki.knowledgesharing.in.th:8080/
>> > ProxyPassReverse / http://wiki.knowledgesharing.in.th:8080/
>> > <Directory />
>> > Options FollowSymLinks
>> > AllowOverride None
>> > </Directory>
>> > </VirtualHost>
>> > The site is live, so you could try it at:
>> > http://wiki.knowledgesharing.in.th/Blog/ (via Apache reverse proxy)
>> > http://wiki.knowledgesharing.in.th:8080/Blog/ (direct to Tomcat, without
>> > reverse proxy)
>> > Thank you very much,
>> > Pongtawat
>>
>> ProxyPass and ProxyPassReverse do not modify the HTML content of the
>> page. From the docs of ProxyPassReverse:
>>
>> Only the HTTP response headers specifically mentioned above will be
>> rewritten. Apache will not rewrite other response headers, nor will it
>> rewrite URL references inside HTML pages. This means that if the
>> proxied content contains absolute URL references, they will by-pass
>> the proxy. A third-party module that will look inside the HTML and
>> rewrite URL references is Nick Kew's mod_proxy_html.
>>
>> Cheers
>>
>> Tom
>>
>> ---------------------------------------------------------------------
>> The official User-To-User support forum of the Apache HTTP Server Project.
>> See <URL:http://httpd.apache.org/userslist.html> for more info.
>> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>>   "   from the digest: users-digest-unsubscribe@httpd.apache.org
>> For additional commands, e-mail: users-help@httpd.apache.org
>>
>
>



-- 
Follow me on Twitter, http://twitter.com/mdevraj

"The secret impresses no-one, the trick you use it for is everything"
- Alfred Borden (The Prestiege)

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Reverse Proxy incorrectly transform content

Posted by Pongtawat Chippimolchai <po...@gmail.com>.
Dear Tom,

Thank you very much for clarifying this. That explains why it work correctly
if I save the page as HTML and let Tomcat serve it statically behind Apache
reverse proxy. So, there must be something wrong with XWiki apps when
working behind Apache. I have checked the request that was send to Tomcat
and it seems ok. So, it might be something in the header or environment?

Thank you,
Pongtawat

On Mon, Feb 8, 2010 at 6:35 PM, Tom Evans <te...@googlemail.com> wrote:

> On Mon, Feb 8, 2010 at 10:50 AM, Pongtawat Chippimolchai
> <po...@gmail.com> wrote:
> > Hello,
> > I'm using Apache to redirect request via reverse proxy to Tomcat on port
> > 8080. On most of the pages, it will work flawlessly. However, on some
> pages,
> > it seems that Apache will incorrectly modify the HTML content (IMO, as
> part
> > of URL transformation). For example the following code:
> > <span class="blog-category-level"><a
> > href="/Blog/CategoryRss?xpage=plain&amp;category=Blog.News" title="RSS">
> > becomes:
> > <span class="blog-category-level"><a href="<span
> class="wikiexternallink"><a
> > class="wikimodel-freestanding"
> > href="
> http://wiki.knowledgesharing.in.th/Blog/CategoryRss?xpage=plain&amp;amp;category=Blog.News
> "><span
> > class="wikigeneratedlinkcontent">
> http://wiki.knowledgesharing.in.th/Blog/CategoryRss?xpage=plain&amp;amp;category=Blog.News
> </span></a></span>"
> > title="RSS">
> > with a mysterious span code inside href attribute.
> > FYI, the original HTML validated as XHTML 1.0 Strict.
> > I have no idea what cause this. Please help.
> > My setting is as follow.
> > Apache version:
> > I have this issue with Apache on both Ubuntu 8.04 and 9.10, i.e. the
> > following versions:
> > Server version: Apache/2.2.8 (Ubuntu)
> > Server built:   Nov 13 2009 21:58:02
> > Server version: Apache/2.2.12 (Ubuntu)
> > Server built:   Nov 12 2009 22:51:51
> > The reverse proxy is configured as follow:
> > <VirtualHost *:80>
> > ServerName wiki.knowledgesharing.in.th
> > ServerAdmin "admin AT knowledgesharing DOT in DOT th"
> > ServerSignature Email
> > ProxyPass / http://wiki.knowledgesharing.in.th:8080/
> > ProxyPassReverse / http://wiki.knowledgesharing.in.th:8080/
> > <Directory />
> > Options FollowSymLinks
> > AllowOverride None
> > </Directory>
> > </VirtualHost>
> > The site is live, so you could try it at:
> > http://wiki.knowledgesharing.in.th/Blog/ (via Apache reverse proxy)
> > http://wiki.knowledgesharing.in.th:8080/Blog/ (direct to Tomcat, without
> > reverse proxy)
> > Thank you very much,
> > Pongtawat
>
> ProxyPass and ProxyPassReverse do not modify the HTML content of the
> page. From the docs of ProxyPassReverse:
>
> Only the HTTP response headers specifically mentioned above will be
> rewritten. Apache will not rewrite other response headers, nor will it
> rewrite URL references inside HTML pages. This means that if the
> proxied content contains absolute URL references, they will by-pass
> the proxy. A third-party module that will look inside the HTML and
> rewrite URL references is Nick Kew's mod_proxy_html.
>
> Cheers
>
> Tom
>
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>   "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>

Re: [users@httpd] Reverse Proxy incorrectly transform content

Posted by Tom Evans <te...@googlemail.com>.
On Mon, Feb 8, 2010 at 10:50 AM, Pongtawat Chippimolchai
<po...@gmail.com> wrote:
> Hello,
> I'm using Apache to redirect request via reverse proxy to Tomcat on port
> 8080. On most of the pages, it will work flawlessly. However, on some pages,
> it seems that Apache will incorrectly modify the HTML content (IMO, as part
> of URL transformation). For example the following code:
> <span class="blog-category-level"><a
> href="/Blog/CategoryRss?xpage=plain&amp;category=Blog.News" title="RSS">
> becomes:
> <span class="blog-category-level"><a href="<span class="wikiexternallink"><a
> class="wikimodel-freestanding"
> href="http://wiki.knowledgesharing.in.th/Blog/CategoryRss?xpage=plain&amp;amp;category=Blog.News"><span
> class="wikigeneratedlinkcontent">http://wiki.knowledgesharing.in.th/Blog/CategoryRss?xpage=plain&amp;amp;category=Blog.News</span></a></span>"
> title="RSS">
> with a mysterious span code inside href attribute.
> FYI, the original HTML validated as XHTML 1.0 Strict.
> I have no idea what cause this. Please help.
> My setting is as follow.
> Apache version:
> I have this issue with Apache on both Ubuntu 8.04 and 9.10, i.e. the
> following versions:
> Server version: Apache/2.2.8 (Ubuntu)
> Server built:   Nov 13 2009 21:58:02
> Server version: Apache/2.2.12 (Ubuntu)
> Server built:   Nov 12 2009 22:51:51
> The reverse proxy is configured as follow:
> <VirtualHost *:80>
> ServerName wiki.knowledgesharing.in.th
> ServerAdmin "admin AT knowledgesharing DOT in DOT th"
> ServerSignature Email
> ProxyPass / http://wiki.knowledgesharing.in.th:8080/
> ProxyPassReverse / http://wiki.knowledgesharing.in.th:8080/
> <Directory />
> Options FollowSymLinks
> AllowOverride None
> </Directory>
> </VirtualHost>
> The site is live, so you could try it at:
> http://wiki.knowledgesharing.in.th/Blog/ (via Apache reverse proxy)
> http://wiki.knowledgesharing.in.th:8080/Blog/ (direct to Tomcat, without
> reverse proxy)
> Thank you very much,
> Pongtawat

ProxyPass and ProxyPassReverse do not modify the HTML content of the
page. From the docs of ProxyPassReverse:

Only the HTTP response headers specifically mentioned above will be
rewritten. Apache will not rewrite other response headers, nor will it
rewrite URL references inside HTML pages. This means that if the
proxied content contains absolute URL references, they will by-pass
the proxy. A third-party module that will look inside the HTML and
rewrite URL references is Nick Kew's mod_proxy_html.

Cheers

Tom

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org