Skip to content

Using XBMC Video Server through a reverse proxy

Sam Stenvall edited this page Aug 15, 2014 · 4 revisions

NOTE! This is not the same as configuring a reverse proxy for XBMC itself, this is about accessing XBMC Video Server through a separate web server.

Background

Reverse proxying is the process of making your application available from another web server, like in the following example:

http://example.com/media is a proxy for http://internal.example.com/xbmc-video-server/src

This guide is only for the Apache web server. If you want to do the proxying with Nginx you're on your own.

Requirements

You'll need to run the following commands:

sudo apt-get install libapache2-mod-proxy-html
sudo a2enmod proxy_http proxy_html

Setup

Here's an example configuration site configuration file for Apache. It has only been tested on Apache 2.2 (Debian Wheezy) and may need some modifications for Apache 2.4. In this example, http://xbmc-video-server.example.com/media is a proxy for http://localhost/xbmc-video-server/src.

<VirtualHost *:80>

        ServerName xbmc-video-server.example.com

        # do the actual proxying
        ProxyPass        /media http://localhost/xbmc-video-server/src
        ProxyPassReverse /media http://localhost/xbmc-video-server/src

        # decompress so we can modify the contents
        SetOutputFilter INFLATE;proxy-html;DEFLATE

        # you may need to uncomment this line with Apache 2.4
        #ProxyHTMLEnable On

        # make sure Apache doesn't try to "fix" the DOCTYPE
        ProxyHTMLDocType "<!DOCTYPE html>"

        # these directives need to be duplicated since we're in a
        # different scope. We actually only want to add "img data-src"
        ProxyHTMLLinks  a               href
        ProxyHTMLLinks  area            href
        ProxyHTMLLinks  link            href
        ProxyHTMLLinks  img             src longdesc usemap data-src
        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

        # finally, rewrite URLs
        ProxyHTMLURLMap /xbmc-video-server/src/ /media/

</VirtualHost>