Geo-block Wowza CDN on Fastly stream targets with the Wowza Streaming Cloud REST API

The Wowza Streaming Cloud™ service allows you to selectively allow or block access to Wowza CDN on Fastly stream targets so that you can control where a stream can be viewed. Learn how to use the REST API to control the locations where your stream can be viewed.

Note: This article applies to Wowza CDN on Fastly stream targets only. To geo-block Wowza CDN on Akamai stream targets, see Geo-block stream targets with the Wowza Streaming Cloud REST API.

Add a Wowza CDN on Fastly stream target for HLS playback


First, add a Wowza stream target configured to play streams from Wowza CDN on Fastly over HLS. You can enable geo-blocking during this step, configure which locations are allowed or blocked, and configure any IP address overrides you may need.

Wowza CDN on Fastly stream target parameters

Parameter Data Type Description
name string (Required) A descriptive name for the stream target. Maximum 255 characters.
geoblock_enabled Boolean If true, controls access to the stream from specific locations and, optionally, IP addresses. The default is false.
geoblock_by_location string Specifies whether to allow or deny access to the stream from specific locations. The default is disabled.
geoblock_country_codes string Required when geoblock_by_location is allow or deny. The locations affected by the geo-blocking. Enter a comma-separated list of uppercase two-letter ISO 3166-1 country codes. For a list, see ISO 3166-1 on Wikipedia.
geoblock_ip_override Boolean Specifies whether specific IP addresses can override the locations that are allowed or restricted. allow permits access from IP addresses within a location that's been blocked, while deny restricts access from IP addresses within locations that are allowed. The default is disabled.
geoblock_ip_addresses string Required when geoblock_ip_override is allow or deny. Enter addresses that can access or restrict the stream even if they're within a specified geo-blocked location. Use a comma-separated list of IPv4 IP addresses that always allow or deny streaming based on the geoblock_ip_override value.

For additional Wowza CDN on Fastly stream target parameters, see the Wowza Streaming Cloud API reference documentation.

Example request and response

Notes:

The following request generates a Wowza CDN on Fastly stream target for HLS playback. It allows only Germany and the United States to view a stream at the target, but denies access from the IP addresses 1.2.3.4 and 9.8.7.6.
 
curl -X POST \
-H "Content-Type: application/json" \
-H "wsc-api-key: ${WSC_API_KEY}" \
-H "wsc-access-key: ${WSC_ACCESS_KEY}" \
-d '{
   "stream_target_fastly": {
     "name": "MyHLSTarget",
     "geoblock_enabled": true,
     "geoblock_by_location": "allow",
     "geoblock_country_codes": "DE, US",
     "geoblock_ip_override": "deny",
     "geoblock_ip_addresses": "1.2.3.4, 9.8.7.6"
   }
 }' "${WSC_HOST}/api/${WSC_VERSION}/stream_targets/fastly"
The details of the configured target are listed in the response, which should look something like this:
 
{
  "stream_target_fastly": {
    "id": "1234abcd",
    "name": "MyHLSTarget",
    "state": "activated",
    "stream_name": "st1r2eam",
    "playback_url": "https://[subdomain].wowza.com/1/[stream_id]/[stream_name]/hls/live/playlist.m3u8",
    "token_auth_enabled": false,
    "token_auth_playlist_only": false,
    "geoblock_enabled": true,
    "geoblock_by_location": "allow",
    "geoblock_country_codes": "DE, US",
    "geoblock_ip_override": "deny",
    "geoblock_ip_addresses": "1.2.3.4, 9.8.7.6",
    "force_ssl_playback": false,
    "created_at": "2016-02-23T16:04:23.170Z",
    "updated_at": "2016-02-23T16:04:23.170Z"
  }
}

Related requests

Update a Wowza CDN on Fastly stream target's geo-blocking configuration:
 
curl -X PATCH \
-H "Content-Type: application/json" \
-H "wsc-api-key: ${WSC_API_KEY}" \
-H "wsc-access-key: ${WSC_ACCESS_KEY}" \
-d '{
   "stream_target_fastly": {
     "geoblock_by_location": "deny",
     "geoblock_country_codes": "DE, US",
  }
 }' "${WSC_HOST}/api/${WSC_VERSION}/stream_targets/fastly/[stream_target_id]"

Assign the stream target to a transcoder


Assign the geo-blocked stream target to a transcoder's output rendition.

Add stream target parameters

Parameter Data Type Description
id string The unique alphanumeric string that identifies the output rendition that will deliver content to the stream target. You can find the ID in the details of the output's transcoder.
stream_target_id string The unique alphanumeric string that identifies the stream target. You can find the ID in the details of the Wowza CDN on Fastly stream target you just created.
transcoder_id string The unique alphanumeric string that identifies the transcoder.

Example request and response

The following request adds the geo-blocked stream target 1234abcd to the output rendition whose ID is 5678efgh for the transcoder 9012ijkl.
 
curl -X POST \
-H "Content-Type: application/json" \
-H "wsc-api-key: ${WSC_API_KEY}" \
-H "wsc-access-key: ${WSC_ACCESS_KEY}" \
-d '{
   "output_stream_target": {
     "stream_target_id": "1234abcd"
   }
 }' "${WSC_HOST}/api/${WSC_VERSION}/transcoders/9012ijkl/outputs/5678efgh/output_stream_targets/"
The details of the configured target are listed in the response, which should look something like this:
 
{
   "output_stream_target": {
    "stream_target_id": "1234abcd"
   }
}

More resources