bittorrent/webui — Issue #1: Reverse Proxy support
Author: WebWacker
Created: 2011-10-13 17:23:40+00:00
State: open

Hi,

Since I'm new to git (hub) I don't want to mess things up by modifying anything myself.
I do have a request/issue though:

I've setup a reverse proxy in IIS 7.5 using ARR and the IIS Rewrite Module. It works like this:
http://mydomain.com/utorrent/ -> http://127.0.0.1:PORT/gui/

The uTorrent WebUI (in webui.js) creates a urlBase variable using the position of "/gui" in window.location.pathname.
Using my external address, the window.location.pathname does not contain "/gui". Hence urlBase will contain an empty string.

I would like urlBase to contain "/utorrent" so that the guiBase variable will contain "/utorrent/gui/" and the reverse proxy will work correctly :).

Would it be possible to substitute the creation of urlBase by the following (ugly) code?

// Determine urlBase (use the entire pathname if "/gui" is not found, use everything before "/gui" otherwise)
var urlBase = (window.location.pathname.indexOf("/gui") == -1) ? window.location.pathname : window.location.pathname.substr(0, window.location.pathname.indexOf("/gui"));

// Remove any trailing / characters
while (urlBase[urlBase.length - 1] == "/")
{
urlBase = urlBase.substr(0, urlBase.length - 1);
}

I've tested this on my server, and it seems to work pretty good :).