I have a Flutter Web application
, and I want to validate the date and time of the Client
side, just like Chrome
or Whatsapp
does. To do this, I decided to send in each request the current date and time within the headers
, and validate it on the Server
, but for some reason I received the error Refused to set unsafe header "date"
in the browser console
, and the field date
is not found within the headers
on the Server
side. Could someone provide me with the correct way to do what I want, or the solution to my problem?
I have already searched several answers but I still do not have the solution, for example one of the most recent
The header name Date
is reserved - only the browser may set it. See Section 4.6.2 of the XMLHttpRequest spec for the complete list. Can you change your header name to, say, Request-Date
? (Of course, it seems it would be easy to forge.)
Also, rather than sending the value as a header, you could send it as a query parameter of a GET, or in the body of a POST (form or JSON).