µTorrent WebUI, Apache 2.2, HTTPS Proxy
Some time ago I set up my µTorrent WebUI interface with HTTPS using stunnel. I followed the instructions I found somewhere on the µTorrent foruns and it worked like a charm.
Now I needed my 443 port to serve some other content witch led me to think about Apache and the mod_proxy module.
After some investigation I managed to get it working the way I wanted and also learned something along the way.
Here goes how I did it:
First download and install Apache 2.2 with SSL (plenty of links throughout the Web on how to do it).
After checking that Apache is serving pages correctly we need to configure it to serve pages through HTTPS. For that we need to make the following changes to the httpd.conf file and create the certificate and key.
Let’s start with this first. Go to the command prompt and issue the following command:
openssl req -config openssl.conf -new -x509 -nodes -out myCertName.crt -keyout myKeyName.key
Now that we have the certificate and key we can configure mod_ssl in Apache. Here are the changes needed:
- Load the SSL module by inserting or uncommenting the line
- Uncomment or insert the following lines (this will include all the configuration from the httpd-ssl.conf file):
- In the httpd-ssl.conf file set the “SSLCertificateFile” and the “SSLCertificateKeyFile” directives like this:
SSLCertificateFile path_to_myCertName.crt SSLCertificateKeyFile path_to_myKeyName.key
- Configure the directories you need to serve through HTTP, like this:
Alias /some_dir_to_serve/ "local_path_to_some_dir_to_serve" <directory local_path_to_some_dir_to_serve=""> Options +Indexes Allow from all </directory>
LoadModule ssl_module modules/mod_ssl.so
<ifmodule ssl_module=""> SSLRandomSeed startup builtin SSLRandomSeed connect builtin Include conf/extra/httpd-ssl.conf </ifmodule>
Now that we have Apache serving pages through SSL we have to configure mod_proxy so it redirects to the µTorrent interface. For that we will need to insert the following configuration directives just before “”:
ProxyRequests Off ProxyPass /new_utorrent_path http://localhost:8080/gui ProxyPassReverse /new_utorrent_path http://localhost:8080/gui ProxyPassReverseCookieDomain localhost:8080 your_domain ProxyPassReverseCookiePath /gui /new_utorrent_path ProxyPreserveHost On
Substitute the 8080 port by your own µTorrent WebUI port. Since µTorrent WebUI uses AJAX and has the default path hardcoded to “/gui”, The last thing we need to do is replace all the “/gui” entries with “/new_utorrent_path” in the javascript files of the webui folder (usually in “C:\Documents and Settings\Application Data\uTorrent\webui”). Now, we point the browser to https://your_domain/new_utorrent_path/ and check if it’s working.