HTTP Webserver Details

Custom HTTP Status codes (Apache)

You can customize the following status codes returned by the webserver module for live presentations. Note that this is customized per play-out format (Iss = Smooth Streaming).

Configuration key Description
Fmp4IssFragmentNotFound The HTTP status code returned when the requested fragment is less than the first fragment available in the DVR window. (Default 404)
Fmp4IssFragmentMissing The HTTP status code returned when the requested fragment number is missing from the DVR window. (Default 412)
Fmp4IssFragmentNotAvailable The HTTP status code returned when the fragment number is larger than the last fragment available in the DVR window. (Default 412)

The customization in Apache is specified on a per-directory (including sub directories) basis using the Directory tag. An example Apache configuration (using the defaults):

<Directory "var/www/live/usp_test/video/errors_rewrite">
  Fmp4IssFragmentNotFound 404
  Fmp4IssFragmentMissing 412
  Fmp4IssFragmentNotAvailable 412
</Directory>

HTTP Response Headers

USP distinguishes two cases: VOD and LIVE. USP only sets any response headers when they are applicable (e.g. when we know that a fragment is going to expire because of the DVR window settings). If there is no explicit expiration of content then we do not insert any default values; it is up to the configuration of the webserver to insert any Cache-Control and/or Expires headers.

Last Modified Time

For VOD the Last-Modified time is always set to the last modified time of the server manifest file (.ism). Note that this applies to the manifest/playlist files as well as any fragments/segments.

For LIVE the Last-Modified time is set to:

  • the time of ingest of the fragment with the highest timestamp (for manifest files).
  • the time of ingest of the fragment (for fragments).

ETag

New in version 1.6.0.

USP uses a revision_id for the ETag. For VOD the ETag is always set to '1', since there is always only 1 revision (the content doesn't change) of the manifest/playlist as well as for the fragments/segments.

For LIVE the ETag is set to:

  • the highest timestamp of any fragment, plus its duration (for manifest files).
  • to '1', except for fragments containing information about following fragments (e.g. HSS) (for fragments).

Cache-Control and Expires

For VOD no Cache-Control or Expires headers are set.

For LIVE the Cache-Control and Expires are set to:

  • the Expires time or max-age when the manifest/playlist expires. This is calculated using the ingest time of the last fragment and its duration. The expiry time is set to the time of the expected ingest time of the next fragment.
  • the Expires time or max-age when the fragment expires (only when there is more than 1 revision of a fragment/segment). This is currently only set for HSS fragments that are close to the live point and don't have all the timing information available for any successive 'lookahead_fragments'.

Starting and stopping Apache

There are a couple of ways to stop, start or restart Apache, which are described here.

Please note that a restart (signal: HUP) will stop all connections, incoming and outgoing.

A 'graceful restart' (signal: USR1) will not, so outgoing streams will continue. However, a Live ingest (the encoder POSTing to the publishing point) will stop, even with a graceful restart. There is no way to reset Apache and keep the ingest intact.

Logrotate

Please note that logrotate will reset all connections, as it does a restart of Apache. This might cause a problem with a Live ingest.

There are two ways to address this:

  • turn off log rotation for the ingest (the encoder POST will only log when it ends, so the logging is minimal anyway)
  • use rotatelogs.