Movatterモバイル変換


[0]ホーム

URL:


  1. Glossary
  2. Forbidden request header

Forbidden request header

Aforbidden request header is anHTTP header name-value pair that cannot be set or modified programmatically in a request. For headers forbidden to be modified in responses, seeforbidden response header name.

Modifying such headers is forbidden because the user agent retains full control over them.For example, theDate header is a forbidden request header, so this code cannot set the messageDate field:

js
fetch("https://httpbin.org/get", {  headers: {    Date: new Date().toUTCString(),  },});

Names starting withSec- are reserved for creating new headers safe fromAPIs that grant developers control over headers, such asfetch().Forbidden headers are one of the following:

Note:TheUser-Agent header used to be forbidden, but no longer is. However, Chrome still silently drops the header from Fetch requests (seeChromium bug 571722).

Note:While theReferer header is listed as a forbidden headerin the spec, the user agent does not retain full control over it and the header can be programmatically modified. For example, when usingfetch(), theReferer header can be programmatically modified via thereferrer option.

Note:Chrome also forbidsAccess-Control-Request-Private-Network

See also

Help improve MDN

Learn how to contribute

This page was last modified on byMDN contributors.


[8]ページ先頭

©2009-2025 Movatter.jp