logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

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.
Post new topic   Forum Index -> Third-party Modules View previous topic :: View next topic
Reply to topic   Topic: mod_proxy + mod_xml2enc + wamp, not loading JS correctly?
Author
mmseng



Joined: 16 Jan 2010
Posts: 4

PostPosted: Sat 16 Jan '10 15:09    Post subject: mod_proxy + mod_xml2enc + wamp, not loading JS correctly? Reply with quote

So I'm running Server 2008, with wamp 2.0, apache 2.2.14, with mod_proxy and mod_xml2enc both installed. The webserver boots up fine.

I'm using a proxy to pull in a couple other small webapps from another LAN server (2003 machine). 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. However as soon as I go to mydomain.com/utorrent/, the redirect never happens, and apache crashes. The error log shows nothing of interest.

I'm assuming this has something to do with the fact that the uTorrent webapp is 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 boot 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.

At some point during all of the tweaks I've tried I was actually getting the redirection to happen without a crash, but the page would never fully load, and apache would throw these errors:

Code:
[Sat Jan 16 01:44:57 2010] [error] [client 10.0.10.1] Charset ISO-8859-1 not supported.  Consider aliasing it?
[Sat Jan 16 01:44:57 2010] [warn] [client 10.0.10.1] No usable charset information; using configuration default


Here's the applicable modules being loaded in httpd.conf:
Code:
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:
Code:
# 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
# LoadModule   proxy_html_module   modules/mod_proxy_html.so
# LoadModule   xml2enc_module      modules/mod_xml2enc.so
#
# For Windows (I don't know if there's a standard path for the libraries)

#
# 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

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

# 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
#
# ProxyHTMLLinks   frame      src longdesc
# ProxyHTMLLinks   iframe      src longdesc
# ProxyHTMLLinks   body      background
# ProxyHTMLLinks   applet      codebase
#
# If you're dealing with proprietary HTML variants,
# declare your own URL attributes here as required.
#
# ProxyHTMLLinks   myelement   myattr 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/
<Location /personal/calibre/>
   ProxyPassReverse /
   ProxyHTMLEnable On
   ProxyHTMLURLMap http://10.0.10.5:8085/ /personal/calibre/
   ProxyHTMLURLMap / /personal/calibre/
</Location>

ProxyPass /personal/ut/ http://10.0.10.5:8082/gui/
<Location /personal/ut/>
   ProxyPassReverse /
   ProxyHTMLEnable On
   ProxyHTMLURLMap http://10.0.10.5:8082/gui/ /personal/ut/
   ProxyHTMLURLMap / /personal/ut/
</Location>


I'm also not entirely sure I'm not missing some vital configuration option.

Any obvious flaws, or other ideas out there? Thanks,
== Matt


Last edited by mmseng on Sun 17 Jan '10 1:55; edited 1 time in total
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7371
Location: Germany, Next to Hamburg

PostPosted: Sat 16 Jan '10 17:02    Post subject: Reply with quote

Hi Matt,
I tried a lot myself to connect to uTorrent. Nothing real with mod_proxy_html worked. OK that time there wasn't mod_xml2enc. So I just use a reverse proxy. Also a different URL than gui did not work Confused

Code:

ProxyPass /gui/ http://localhost:8080/gui/
ProxyPassReverse /gui/ http://localhost:8080/gui/


Mario
Back to top
mmseng



Joined: 16 Jan 2010
Posts: 4

PostPosted: Sun 17 Jan '10 0:53    Post subject: Reply with quote

I'm not sure I understood any of what you said :/

However you gave me some ideas to try in messing with my config.
Back to top
mmseng



Joined: 16 Jan 2010
Posts: 4

PostPosted: Sun 17 Jan '10 1:49    Post subject: Reply with quote

Ok so I simplified my config and I'm no longer getting the crashing.

I replaced this:
Code:
ProxyPass /personal/calibre/ http://10.0.10.5:8085/
<Location /personal/calibre/>
   ProxyPassReverse /
   ProxyHTMLEnable On
   ProxyHTMLURLMap http://10.0.10.5:8085/ /personal/calibre/
   ProxyHTMLURLMap / /personal/calibre/
</Location>

ProxyPass /personal/ut/ http://10.0.10.5:8082/gui/
<Location /personal/ut/>
   ProxyPassReverse /
   ProxyHTMLEnable On
   ProxyHTMLURLMap http://10.0.10.5:8082/gui/ /personal/ut/
   ProxyHTMLURLMap / /personal/ut/
</Location>


with this:
Code:
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/


Now calibre still works normally, and uTorrent will display SOMETHING. But it looks like the page is missing all of its formatting/javascript, and it's internal activity indicator loading animation (probably part of the JS) is just stuck continually loading.

So my guess is I'm back to having a problem with mod_xml2enc not properly forwarding the JS or XML or something. But that's just a noobie's guess. I'm new at most of this stuff.

Now here are the errors I get when trying to load uT:

Code:
[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.
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7371
Location: Germany, Next to Hamburg

PostPosted: Sun 17 Jan '10 15:26    Post subject: Reply with quote

Sorry for my bad english Embarassed

Something inside the programming of uTorrent requires that the URL is /gui/ and not /ut/
I tried a lot to change that, but it worked only with /gui/

so in your case you can try

Code:

ProxyPass /gui/ http://10.0.10.5:8082/gui/
ProxyPassReverse /gui/ http://10.0.10.5:8082/gui/


I may take a look into the uTorrent GUI code, but I'm not sure I find the issue.
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7371
Location: Germany, Next to Hamburg

PostPosted: Sun 17 Jan '10 16:47    Post subject: Reply with quote

Well I found the issue code in webui.zip -> webui.js.gz -> webui.js
Back to top
mmseng



Joined: 16 Jan 2010
Posts: 4

PostPosted: Mon 18 Jan '10 7:30    Post subject: Reply with quote

I've got everything working the way I want it now. For those interested, see the following post at the uT forums for how I did it:

http://forum.utorrent.com/viewtopic.php?pid=446453#p446453
Back to top


Reply to topic   Topic: mod_proxy + mod_xml2enc + wamp, not loading JS correctly? View previous topic :: View next topic
Post new topic   Forum Index -> Third-party Modules