BitTorrent Sync allows you to keep files synchronized between multiple computers or mobile devices. It’s a handy way to do backups, share files with friends, or automate the movement of data from device to device. It comes with a web frontend, called the Web UI, that allows for connections over HTTP or HTTPS.
Using HTTP across the internet to administer Sync seems totally absurd, so I decided to enable HTTPS. I quickly realized two things:
- My SSL certificates were now specified in Apache and Sync
- Sync’s Web UI is relatively slow with SSL enabled (especially over higher latency links)
ProxyPass /btsync http://127.0.0.1:8888 ProxyPassReverse /btsync http://127.0.0.1:8888 ProxyHTMLURLMap http://127.0.0.1:8888 /btsync Redirect permanent /gui /btsync/gui
The ProxyPass and ProxyPassReverse lines tell Apache where to proxy the requests and it also tells Apache to make requests on behalf of the browser making the request. The ProxyHTMLURLMap directive tells Apache that any requests to
/btsync from a client browser should be translated as a request to the root directory (
/) of the Web UI. The last line redirects hard-coded requests to
/gui up to
When your configuration is in place, be sure to run a configuration check (
httpd -S) and reload the Apache daemon. If you’d like to access your application at a different URI, just replace
/btsync in the example configuration with that URI.
Once all this is done, I’m able to access Sync at
https://example.com/btsync and Apache handles all of the backend requests properly. On some distributions, you may find that mod_proxy_html isn’t installed by default. You’ll need to install it if you want to use ProxyHTMLURLMap in your configuration. For Fedora users, just install it via yum:
yum install mod_proxy_html