Configuration

Configuring ew-manip and the Repackager

Configuring ew-manip

The repackager is normally running as an HTTP server on port 80. The ew-manip service would typically run on the same host with the default port 8094. The port can be changed in the service file at: /usr/lib/systemd/system/ew-manip.service key: ExecStart

If the repackager is not running on port 80, or on a different host from ew-manip, then this should be specified on the same line in the service file by adding: -u <repackager-hostname:port>

In the resulting combined manifest, the pre-roll content URL will point to another asset, and its URL needs to be an absolute URL. This does not have to be configured since the full absolute URL must be sent in the query string.

Repackager configuration (nginx routing)

The nginx routing must be manually configured in the repackager. Two things must be added:

  • the forwarding trigger ewm=
  • the ew-manip service address

To do that, add the following two location {...} entries to the nginx config file at: /etc/ew-repackager/ew-repackager-custom.conf

location ~ ^/__cl/.*\.(m3u8|mpd)$ {
    error_page 453 = @manip_query;
    if ( $args ~ "^ewm=" ) { return 453; }
    add_header 'Access-Control-Allow-Origin' '*' always;
}

location @manip_query {
    proxy_pass http://localhost:8094;
    proxy_http_version 1.1;
    proxy_set_header Connection "";
    proxy_connect_timeout 1s;
    proxy_read_timeout 1s;
}

The value HTTP error code 453 is arbitrary, but should be outside the defined value in order to avoid collisions.

This will make requests with URLs ending with .m3u8 or .mpd containing the string ewm= at the start of the query string to be forwarded to the ew-manip server at http://localhost:8094.