The restUserHTTPHeaders property allows you to configure WSE REST API HTTP headers from your WSE server's Server.xml configuration file. The value for this property is a pipe-delimited list of header:value pairs, as shown below.
<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 WSE configuration in the WSE Manager.
- Navigate to WSE Manager.
- Click the
Servertab. - In the contents lick
Server Setupin the contents panel. - In the
Server Setuppage, click thePropertiestab. - In the
Quick Linksbar, clickCustom.
Access to the Properties tab is limited to administrators with advanced permissions. For more information, see the administrator getting started guide.
In the
Customarea, clickEditClick
Add Custom Property.In the
Add Custom Propertydialog box:Path: Select/Root/Server/RESTInterfaceName: EnterrestUserHTTPHeadersType: SelectStringValue: Enter any combination of desired CORSheader:valuepairs in a pipe-delimited list. For details and examples, see Configure CORS header properties
Click Add, click Save, and then restart the Wowza Streaming Engine.
- Navigate to
[install-dir]/conf. - Open
Server.xml. - Add the
restUserHTTPHeadersproperty to the<RESTInterface>/<Properties>element as shown below.
<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.
- Save your changes and restart Wowza Streaming Engine.
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 WSE 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>