How to add HTTP headers to Wowza Streaming Engine REST API responses

You can add the restUserHTTPHeaders property to your Wowza Streaming EngineTM server configuration to enable HTTP headers to be added to REST API response messages. The property value is a pipe-delimited list of header:value pairs, like this:

<Property>
    <Name>restUserHTTPHeaders</Name>
    <Value>header1:value1|header2:value2A,value2B|header3:value3</Value>
</Property>

You can add the restUserHTTPHeaders property and cross-origin resource sharing (CORS) header:value pairs to your Wowza Streaming Engine configuration in the Wowza Streaming Engine Manager or by editing the Server.xml file directly.

Contents


Add the restUserHTTPHeaders property in Streaming Engine Manager
Add the restUserHTTPHeaders property in XML
Configure CORS header properties

Add the restUserHTTPHeaders property in Streaming Engine Manager


  1. In Wowza Streaming Engine Manager, click the Server tab, and then click Server Setup in the contents pane.
  2. In the Server Setup page, click the Properties tab and then click Custom in the Quick Links bar.

Note: Access to the Properties tab is limited to administrators with advanced permissions. For more information, see Manage credentials.

  1. In the Custom area, click Edit and then click Add Custom Property.
  2. Specify the following settings in the Add Custom Property dialog box:
  • Path - Select /Root/Server/RESTInterface.
  • Name - Enter restUserHTTPHeaders.
  • Type - Select String.
  • Value - Enter any combination of desired CORS header:value pairs in a pipe-delimited list. For details and examples, see Configure CORS header properties.
  1. Click Add, click Save, and then restart the Wowza Streaming Engine.

Add the restUserHTTPHeaders property in XML


  1. Go to [install-dir]/conf and open Server.xml file in a text editor.
  2. Add the restUserHTTPHeaders property to the <RESTInterface>/<Properties> section as follows:
<RESTInterface>
    <Properties>
        <Property>
            <Name>restUserHTTPHeaders</Name>
            <Value>header1:value1|header2:value2A,value2B|header3:value3</Value>
        </Property>
    </Properties>
</RESTInterface>

For details and examples of CORS header:value pairs, see Configure CORS header properties.

  1. Save your changes and restart Wowza Streaming Engine.

Configure CORS header properties


Note: CORS headers are enabled by default in the Wowza Streaming Engine 4.5.0 and later REST API.

  • To enable CORS for specific domains, such as foo.example and bar.test, specify:
<Properties>
    <Property>
        <Name>restUserHTTPHeaders</Name>
        <Value>Access-Control-Allow-Origin:http://foo.example,http://bar.test</Value>
    </Property>
</Properties>
  • By default, CORS only allows the GET, HEAD, and POST request methods. To enable all Wowza Streaming Engine REST API request methods, add the CORS Access-Control-Allow-Methods header, specify:
<Properties>
    <Property>
        <Name>restUserHTTPHeaders</Name>
        <Value>Access-Control-Allow-Origin:http://foo.example,http://bar.test|Access-Control-Allow-Methods:OPTIONS,GET,PUT,DELETE,POST</Value>
    </Property>
</Properties>
  • To allow the browser to access specific REST API headers, add the CORS Access-Control-Allow-Headers header, specify:
<Properties>
    <Property>
        <Name>restUserHTTPHeaders</Name>
        <Value>Access-Control-Allow-Origin:http://foo.example,http://bar.test|Access-Control-Allow-Methods:OPTIONS,GET,PUT,DELETE,POST| Access-Control-Allow-Headers:Content-Type,My-Custom-Header</Value>
        </Property>
</Properties>
  • The restUserHTTPHeaders property value can also have a custom HTTP header. For example, to add My-Custom-Header to the REST API response, specify:
<Properties>
    <Property>
        <Name>restUserHTTPHeaders</Name>
        <Value>My-Custom-Header:[HeaderValue]</Value>
    </Property>
</Properties>

If you're having problems or want to discuss this article, post in our forum.