Forum Moderators: phranque
I'm using a reverse proxy to pull in a couple other small webapps from another LAN server. One of the apps is the built-in content server of Calibre (an e-book mgmt app). This works just fine. I can go to mydomain.com/calibre/ and it pulls everything in fine, while keeping the masked URL.
The other app I'm proxying to is the webUI of uTorrent. It will redirect/rewrite properly, however the page doesn't display correctly, having unfinished formatting and a hung up internal activity indicator animation.
I'm assuming this has something to do with the fact that the uTorrent webapp appears to be heavily JS/XML based. However to my understanding, mod_xml2enc should take care of that. It's easily possible that I don't have it installed quite right, but apache does start up with mod_xml2enc enabled, with no complaints. Yes, I have the necessary prereq windows libraries installed, namely, libxml2.dll, which also relies on zlib1.dll and iconv.dll, to my knowledge. It's also possible that I have incompatible versions of these files, as they are scattered all over the internet like treasures of old, with documentation to match.
Here's the applicable modules being loaded in httpd.conf:
---------------------------------------------------------
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so
LoadModule deflate_module modules/mod_deflate.so
LoadModule headers_module modules/mod_headers.so
LoadModule proxy_html_module modules/mod_proxy_html.so
LoadFile bin/zlib1.dll
LoadFile bin/iconv.dll
LoadFile bin/libxml2.dll
LoadModule xml2enc_module modules/mod_xml2enc.so
-------------------------------------------------
And here is the proxy config:
-------------------------------------------------
# Configuration example.
#
# First, to load the module with its prerequisites. Note: mod_xml2enc
# is not always necessary, but without it mod_proxy_html is likely to
# mangle pages in encodings other than ASCII or Unicode (utf-8).
#
# For Unix-family systems:
# LoadFile/usr/lib/libxml2.so
# LoadModuleproxy_html_modulemodules/mod_proxy_html.so
# LoadModulexml2enc_modulemodules/mod_xml2enc.so
#
# All knowledge of HTML links has been removed from the mod_proxy_html
# code itself, and is instead read from httpd.conf (or included file)
# at server startup. So you MUST declare it. This will normally be
# at top level, but can also be used in a <Location>.
#
# Here's the declaration for W3C HTML 4.01 and XHTML 1.0
#
ProxyHTMLLinksahref
ProxyHTMLLinksareahref
ProxyHTMLLinkslinkhref
ProxyHTMLLinksimgsrc longdesc usemap
ProxyHTMLLinksobjectclassid codebase data usemap
ProxyHTMLLinksqcite
ProxyHTMLLinksblockquotecite
ProxyHTMLLinksinscite
ProxyHTMLLinksdelcite
ProxyHTMLLinksformaction
ProxyHTMLLinksinputsrc usemap
ProxyHTMLLinksheadprofile
ProxyHTMLLinksbasehref
ProxyHTMLLinksscriptsrc for
#
# To support scripting events (with ProxyHTMLExtended On),
# you'll need to declare them too.
#
ProxyHTMLEventsonclick ondblclick onmousedown onmouseup \
onmouseover onmousemove onmouseout onkeypress \
onkeydown onkeyup onfocus onblur onload \
onunload onsubmit onreset onselect onchange
#
# If you need to support legacy (pre-1998, aka "transitional") HTML or XHTML,
# you'll need to uncomment the following deprecated link attributes.
# Note that these are enabled in earlier mod_proxy_html versions
#
# ProxyHTMLLinksframesrc longdesc
# ProxyHTMLLinksiframesrc longdesc
# ProxyHTMLLinksbodybackground
# ProxyHTMLLinksappletcodebase
#
# If you're dealing with proprietary HTML variants,
# declare your own URL attributes here as required.
#
# ProxyHTMLLinksmyelementmyattr otherattr
#
###########
# EXAMPLE #
###########
#
# To define the URL /my-gateway/ as a gateway to an appserver with address
# http://some.app.intranet/ on a private network, after loading the
# modules and including this configuration file:
#
# ProxyRequests Off <-- this is an important security setting
# ProxyPass /my-gateway/ http://some.app.intranet/
# <Location /my-gateway/>
#ProxyPassReverse /
#ProxyHTMLEnable On
#ProxyHTMLURLMap http://some.app.intranet/ /my-gateway/
#ProxyHTMLURLMap / /my-gateway/
# </Location>
#
# Many (though not all) real-life setups are more complex.
#
# See the documentation at
# http://apache.webthing.com/mod_proxy_html/
# and the tutorial at
# http://www.apachetutor.org/admin/reverseproxies
#
ProxyRequests Off
ProxyHTMLExtended On
ProxyHTMLMeta On
ProxyHTMLLogVerbose On
#
ProxyPass /personal/calibre/ http://10.0.10.5:8085/
ProxyPassReverse /personal/calibre/ http://10.0.10.5:8085/
#
ProxyPass /personal/ut/ http://10.0.10.5:8082/gui/
ProxyPassReverse /personal/ut/ http://10.0.10.5:8082/gui/
#
----------------------------------------------------------------
I'm also not entirely sure I'm not missing some vital configuration option.
Now here are the errors I get when trying to load uT:
-----------------------------------------------------
[Sat Jan 16 17:39:03 2010] [error] [client 10.0.10.1] File does not exist: D:/apps/wamp/www/mydomain.com.80/gui, referer: http://www.mydomain.com/personal/ut/
[Sat Jan 16 17:39:36 2010] [error] [client 10.0.10.1] File does not exist: D:/apps/wamp/www/mydomain.com.80/gui, referer: http://www.mydomain.com/personal/ut/
-----------------------------------------------------
For some reason it tries to look in my webserver's document root for "/gui", instead of looking straight to the uT server for "/gui/". However this doesn't seem to be an issue as I AM actually being forwarded to the right server, even if it doesn't load the page right.
Any obvious flaws, or other ideas out there? Thanks,
== Matt
#
ProxyPass /personal/calibre/ http://10.0.10.5:8085/
ProxyPassReverse /personal/calibre/ http://10.0.10.5:8085/
#
ProxyPass /personal/ut/ http://10.0.10.5:8082/gui/
ProxyPassReverse /personal/ut/ http://10.0.10.5:8082/gui/
#
The error messages and above code appear to show that you have a problem in the HTML, with absolute paths for scripts and stylesheets etc. pointing to
/gui/ and thus outside the scope of the proxy rules above (because /gui/ is not under /personal/. Short of fixing the HTML to use the right paths (or switching to relative paths), I'm not sure of the best solution, so I'll let some of our Apache experts chime in :)
[forum.utorrent.com...]