-
Notifications
You must be signed in to change notification settings - Fork 38
Configuring a reverse proxy
When configuring a backend, you'll notice the "Proxy Location" setting. Without it, all requests to the XBMC API (including the URLs to your movies and TV shows) are in the form of http://user:pass@hostname:port/vfs/pathtomovie.mkv
. This means that in order to use the application over the Internet you'd have to forward the right port (usually 8080) to the machine running XBMC in addition to forwarding port 80 to the machine running XBMC Video Server. It also means you'd be exposing the XBMC API credentials to anyone using your application.
To avoid this we can tell Apache (the actual web server) to forward requests on a particular location (/xbmc-vfs
in these examples) to http://user:pass@hostname:port/vfs
. This way your API credentials won't leak through the media URLs.
There are various issues that can be solved by using a reverse proxy:
- XBMC credentials are not exposed through the media URLs
- External use will work even if the backend is configured with an internal IP address
- Clicking the "Download" links in Internet Explorer won't require you to enter the API credentials
- Clicking the "Download" link in Firefox will correctly open the "Save file as" dialog like it should
Let's say you have installed XBMC Video Server on one machine (http://xbmc-video-server.example.com/xbmc-video-server/) and XBMC is running on a different machine (http://xbmc.example.com:8080/). What we want to do is forward requests on http://xbmc-video-server.example.com/xbmc-vfs
to http://xbmc.example.com:8080/vfs
.
- Open the file
/etc/apache2/sites-available/default
(/etc/apache2/sites-available/000-default.conf
on newer Ubuntu versions) and add the following inside the<VirtualHost *:80>
block:
AllowEncodedSlashes On
<Location /xbmc-vfs>
ProxyPass http://xbmc.example.com:8080/vfs nocanon
RequestHeader set Authorization "Basic eGJtYzp4Ym1j"
</Location>
Replace /xbmc-vfs
by anything you like, preferably something non-guessable (see Security implications). Then, replace xbmc.example.com:8080
with the IP address/hostname and port of the machine that runs XBMC. Finally, replace eGJtYzp4Ym1j
with your username:password
encoded as Base64 (e.g. xbmc:mysecret -> eGJtYzpteXNlY3JldA==).
- Save the file and run
sudo a2enmod headers proxy_http && sudo service apache2 restart
- In XBMC Video Server, go to Settings -> Backends -> Update and put
/xbmc-vfs
in the "Proxy location" field.
- Open
C:\xampp\apache\conf\httpd.conf
and remove the leading hashtag from the line#LoadModule proxy_http_module
. Save the file. - Open
C:\xampp\apache\conf\extra\httpd-proxy.conf
. Remove everything between the two<IfModule>
sections, then add the following instead:
AllowEncodedSlashes On
<Location "/xbmc-vfs">
ProxyPass http://gorbachov.negge.fi:8080/vfs nocanon
RequestHeader set Authorization "Basic eGJtYzp4Ym1jMQ=="
</Location>
See the Linux instructions on what the values mean and what you should replace them with.
- Finally, open the XAMPP Control Panel and restart Apache.
- In XBMC Video Server, go to Settings -> Backends -> Update and put
/xbmc-vfs
in the "Proxy location" field.