Support XFF headers in HTTP streaming requests to Wowza Streaming Engine

The X-Forward-For (XFF) header is a common HTTP header field that is used to identify the IP address from which the streaming request originated. This article describes how to configure Wowza Streaming Engine™ media server software to support XFF headers in these requests.

Notes:
  • Support for XFF headers in streaming requests requires Wowza Streaming Engine 4.7.5.02 or later.
  • The instructions in this article apply to Wowza Streaming Engine 4.8.8.01 and later.
  1. In a text editor, open [install-dir]/conf/log4j2-config.xml.
  2. Make the following changes to the serverAccess RollingFile (RollingFile name="serverAccess") element:
     
    • At the end of the Header value before %n, add tx-forwarded-ip using a backslash to separate the new header.
      <Header>
      #Version: 1.0\n#Start-Date: %d{YYY-MM-dd HH:mm:ss zzz}\n#Software: ${sys:wse-software-version}\n#Date: %d{YYY-MM-dd}\n#Fields: date\ttime\ttz\tx-event\tx-category\tx-severity\tx-status\tx-ctx\tx-comment\tx-vhost\tx-app\tx-appinst\tx-duration\ts-ip\ts-port\ts-uri\tc-ip\tc-proto\tc-referrer\tc-user-agent\tc-client-id\tcs-bytes\tsc-bytes\tx-stream-id\tx-spos\tcs-stream-bytes\tsc-stream-bytes\tx-sname\tx-sname-query\tx-file-name\tx-file-ext\tx-file-size\tx-file-length\tx-suri\tx-suri-stem\tx-suri-query\tcs-uri-stem\tcs-uri-query\tx-forwarded-ip%n
      </Header>
      

       
    • At the end of the Pattern value before %n, add t%replace{%X{x-forwarded-ip}}{^$}{-} using a backslash to separate the new pattern.
      <Pattern>
      %d{yyyy-MM-dd}\t%d{HH:mm:ss}\t%d{z}\t%replace{%X{x-event}}{^$}{-}\t%replace{%X{x-category}}{^$}{-}\t%replace{%X{x-severity}}{^$}{-}\t%replace{%X{x-status}}{^$}{-}\t%replace{%X{x-ctx}}{^$}{-}\t%replace{%X{x-comment}}{^$}{-}\t%replace{%X{x-vhost}}{^$}{-}\t%replace{%X{x-app}}{^$}{-}\t%replace{%X{x-appinst}}{^$}{-}\t%replace{%X{x-duration}}{^$}{-}\t%replace{%X{s-ip}}{^$}{-}\t%replace{%X{s-port}}{^$}{-}\t%replace{%X{s-uri}}{^$}{-}\t%replace{%X{c-ip}}{^$}{-}\t%replace{%X{c-proto}}{^$}{-}\t%replace{%X{c-referrer}}{^$}{-}\t%replace{%X{c-user-agent}}{^$}{-}\t%replace{%X{c-client-id}}{^$}{-}\t%replace{%X{cs-bytes}}{^$}{-}\t%replace{%X{sc-bytes}}{^$}{-}\t%replace{%X{x-stream-id}}{^$}{-}\t%replace{%X{x-spos}}{^$}{-}\t%replace{%X{cs-stream-bytes}}{^$}{-}\t%replace{%X{sc-stream-bytes}}{^$}{-}\t%replace{%X{x-sname}}{^$}{-}\t%replace{%X{x-sname-query}}{^$}{-}\t%replace{%X{x-file-name}}{^$}{-}\t%replace{%X{x-file-ext}}{^$}{-}\t%replace{%X{x-file-size}}{^$}{-}\t%replace{%X{x-file-length}}{^$}{-}\t%replace{%X{x-suri}}{^$}{-}\t%replace{%X{x-suri-stem}}{^$}{-}\t%replace{%X{x-suri-query}}{^$}{-}\t%replace{%X{cs-uri-stem}}{^$}{-}\t%replace{%X{cs-uri-query}}{^$}{-}\t%replace{%X{x-forwarded-ip}}{^$}{-}%n
      </Pattern>
      
  3. Save your changes and restart Wowza Streaming Engine to apply them.

After you've added support for XFF headers, when an HTTP streaming request with an XFF header is received, the IP address will be visible in the wowzastreamingengine_access.log file.