TsgcWebSocketServer_HTTPAPI | Custom Headers

You can customize the response of HTTP.SYS server using the CustomHeaders property of response object.

 

Just set the value of CustomHeaders with the Header Name + Header Value separated by NewLine Characters.

 

Example: if you want to add the following headers, find below a sample code

 

Access-Control-Allow-Origin: *

Acces-Control-Allow-Methods: GET, POST, OPTIONS, PUT, PATCH, DELETE

 


private void OnHTTPRequest(TsgcWSConnection_HTTPAPI *aConnection, const THttpServerRequest *aRequestInfo, 
  ref THttpServerResponse *aResponseInfo)
{
  aResponseInfo->ResponseNo = 200;
  aResponseInfo->CustomHeaders = "Access-Control-Allow-Origin: *" + #13#10 + "Acces-Control-Allow-Methods: " +
    "GET, POST, OPTIONS, PUT, PATCH, DELETE'";
}