With HTTP communication, various HTTP headers are used between the Web browser and the Web server. The Web browser and the Web server sometimes determine the subsequent operations by using the received HTTP headers. The HTTP headers added by the Web browser at the time of sending an HTTP request is called the request header, and the HTTP header added by the Web server in the response is called the response header. The functionality that is used for the Web server or the Web browser to perform a specific operation by adding, changing, or deleting the request header, which is received or sent by the Web server, is called the header customization functionality.
You can use header customization functionality by embedding the mod_headers module in Cosminexus HTTP Server.
You must embed the mod_headers module to use the header customization functionality. Specify the following directive in configuration file (httpsd.conf) to embed the mod_headers module:
LoadModule headers_module libexec/mod_headers.so |
LoadModule headers_module modules/mod_headers.so |
The header customization functionality is specified in the Header directive or the RequestHeader directive. The following shows examples of setting the directive to use the header customization functionality.
The response header can be set by using the set indicator of the Header directive. If the response header with the same name is already set in another module, the header value is overwritten.
The following is an example in which Expires: Sat, 1 Jan 2000 00:00:00 GMT is set in the response header. However, to set the expiry date dynamically, use the expiry date settings functionality:
Header set Expires "Sat, 1 Jan 2000 00:00:00 GMT" |
The response header can be added by using the add indicator of the Header directive. Even when the response header with the same name is already set in another module, the header is added as an additional header. The add indicator is used to set response headers with the same name on multiple lines.
The following is an example to add Set-Cookie: HOSTNAME=HOST1; path=/; domain=www.example.com; secure in response header:
Header add Set-Cookie "HOSTNAME=HOST1; path=/; domain=www.example.com; secure" |