AddHeader callback function

Applies to: desktop apps only

The AddHeader callback function adds an HTTP header to an incoming request after an SF_NOTIFY_PREPROC_HEADERS or SF_NOTIFY_AUTH_COMPLETE event notification, to an incoming response after an SF_NOTIFY_RECEIVE_RESPONSE_HEADERS notification, or to an outgoing response after an SF_NOTIFY_SEND_RESPONSE notification. For more information about the types of event notifications that are sent to Web filters, see Event Notifications.

The AddHeader callback function is declared as:


  _In_  struct _HTTP_FILTER_CONTEXT *pfc,
  _In_  LPSTR lpszName,
  _In_  LPSTR lpszValue


  • pfc [in]
    Pointer to the HTTP_FILTER_CONTEXT data structure that is associated with the current, active HTTP session. Pass the filter context in this parameter.

  • lpszName [in]
    Pointer to a null-terminated string containing the name of the header to add. Header names should include the trailing colon (:). This parameter is not case-sensitive.

  • lpszValue [in]
    Pointer to a null-terminated string containing the new value to add to the header, or to "\0" to add a header with an empty value.

Return value

This callback function returns TRUE if the call is successful; otherwise, it returns FALSE. To obtain extended error information, call GetLastError, which may return one of the following Windows system error codes:

    The header was successfully added. This error code is returned when the callback function returns TRUE.

    The value specified in the lpszValue parameter is invalid. This error code is also returned after an SF_NOTIFY_AUTH_COMPLETE notification if the filter tries to modify the URL, method, or version portion of the request line.

    Not enough memory was available to complete the requested operation.

    The request is an HTTP 0.9 request, or the value specified in the lpszName parameter is not valid.


A pointer to this function is included as a member of the following structures:


Minimum supported client

None supported

Minimum supported server

Windows Server 2008 R2, Windows Server 2008 with SP2 (64-bit only)


Forefront Threat Management Gateway (TMG) 2010



See also

Callback Functions



Build date: 7/12/2010