Seitenhierarchie

  Wiki Navigation

    Loading...


 Recently Updated


 Latest Releases

 MediaPortal 1.32
            Releasenews | Download
 MediaPortal 2.5
            Releasenews | Download


Information on this page relates to a development version of the application and is subject to change.

MPExtended runs as a self-contained web server which does not support HTTPS. However, it is possible to add this by putting MPExtended behind an incoming proxy.

The root of all MPExtended URLs is http://<hostname>:4322/MPExtended so any web server that supports HTTPS and URL rewriting can be configured to act as a proxy. Example configurations are shown here.

MPExtended incoming proxy using IIS

Pre-requisite: You need to have URL Rewrite installed which you can get from the Microsoft web site.

Add a new application (not a virtual application). These settings are only a guide; you can use change them to suit your setup as long as the virtual path is correct:

  • Application Pool: RootApp
  • Physical Path: c:\inetpub\MPExtended
  • Virtual Path: /MPExtended

There are two ways to do authentication. If MPExtended already requires credentials then you should go to the Authentication section, enable Anonymous and disable the others. If MPExtended does not require credentials you should enable Basic and disable the others.

Assuming the pre-requisites are done you should see "URL Rewrite". In the Actions panel go to View Server Variables and add "HTTP_X_Root_URL" as a Local (it's case sensitive).

The rules can be configured from here but it's easier to edit web.config in c:\inetpub\MPExtended (or wherever you created the application) and paste the settings in:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
    <rewrite>
      <rules>
                <clear />
                <rule name="Proxy">
                    <match url="^(.+)$" />
                    <conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
                    <serverVariables>
                        <set name="HTTP_X_Root_URL" value="{MapSSL:{HTTPS}}{SERVER_NAME}:{SERVER_PORT}" />
                    </serverVariables>
                    <action type="Rewrite" url="http://*<YOUR_HTPC>*:4322/MPExtended/{R:1}" />
                </rule>
      </rules>
      <rewriteMaps>
        <rewriteMap name="MapSSL" defaultValue="OFF">
          <add key="ON" value="https://" />
          <add key="OFF" value="http://" />
        </rewriteMap>
      </rewriteMaps>
    </rewrite>
</system.webServer>
</configuration>


Replace <YOUR_HTPC> with the machine you're running MPExtended on (which could be localhost of course).

MPExtended incoming proxy using Apache HTTPD

Pre-requisite: rewrite_module and headers_module, statically or using LoadModule


Add the following to your config file:

<IfModule rewrite_module>
<Location /MPExtended>
RewriteEngine on
<IfModule headers_module>
# Capture the original host and port
RewriteRule .* - [E=HTTP_HOST:%{HTTP_HOST},NE]
RewriteRule .* - [E=SERVER_PORT:%{SERVER_PORT},NE]
# Default the scheme to HTTP, then change to HTTPS if that is set
RequestHeader set X-Original-Host "http://%{HTTP_HOST}e:%{SERVER_PORT}e"
RequestHeader set X-Original-Host "https://%{HTTP_HOST}e:%{SERVER_PORT}e" env=HTTPS
</IfModule>
RewriteRule ^.*/MPExtended/(.+)$ http://*<YOUR_HTPC>*:4322/MPExtended/$1 [P]
</Location>
</IfModule>


Replace <YOUR_HTPC> with the machine you're running MPExtended on (which could be localhost of course).

What's with the root URL header?

Some MPExtended operations return a self-referential URL (in particular the streaming functions). When a client requests https://www.external.com/MPExtended the proxy makes MPExtended think you asked for http://internal:4322 so it will create URLs which use the internal form and they won't be accessible externally. There are two ways to get around this:


  • Add a reverse proxy rule to replace internal URLs with external URLs. This is prone to false positives, needs extra escaping for JSON data and won't work at all if the response from MPExtended is compressed
  • Use the Root URL request header which MPExtended will use when building self-referential URLs


The second method is obviously preferable.

   

 

This page has no comments.