I want to set the header for http request. The header name is "Date"
http_request.setRequestHeader("Date", headers.date);
But, when I see the request going out in firebug. I do not see the request header Date.
How do I set that?
The Date property represents the value of a Date HTTP header on an HTTP response. The Date header is the date and time the message was sent. Javascript and . NET languages do not use the DateTime object directly.
An origin server MUST NOT send a Date header field if it does not have a clock capable of providing a reasonable approximation of the current instance in Coordinated Universal Time. An origin server MAY send a Date header field if the response is in the 1xx (Informational) or 5xx (Server Error) class of status codes.
Select the web site where you want to add the custom HTTP response header. In the web site pane, double-click HTTP Response Headers in the IIS section. In the actions pane, select Add. In the Name box, type the custom HTTP header name.
2 digit minute number, e.g. "04" or "59". 2 digit second number, e.g. "04" or "59". Greenwich Mean Time. HTTP dates are always expressed in GMT, never in local time.
From a XMLHttpRequest, there are a set of headers that cannot be set. Take a look at the spec for setRequestHeader(). Date
is one of these headers.
Also, if you look at the WebKit source code, you can see this in implementation.
bool XMLHttpRequest::isAllowedHTTPHeader(const String& name)
{
initializeXMLHttpRequestStaticData();
return !staticData->m_forbiddenRequestHeaders.contains(name)
&& !name.startsWith(staticData->m_proxyHeaderPrefix, false)
&& !name.startsWith(staticData->m_secHeaderPrefix, false);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With