The HTTP Origin request header indicates the origin (scheme, hostname, and port) that caused the request. For example, if a user agent needs to request resources included in a page, or fetched by scripts that it executes, then the origin of the page may be included in the request.Header type Request header Forbidden request header Yes
Origin: null
Origin: <scheme>://<hostname>
Origin: <scheme>://<hostname>:<port>nullThe origin is "privacy sensitive", or is an opaque origin (specific cases are listed in the description section).
<scheme>The protocol that is used. Usually, it is the HTTP protocol or its secured version, HTTPS.
<hostname>The domain name or the IP address of the origin server.
<port> OptionalPort number on which the server is listening. If no port is given, the default port for the requested service is implied from the scheme (e.g., 80 for an HTTP URL).
The Origin header is similar to the Referer header, but does not disclose the path, and may be null. It is used to provide the security context for the origin request, except in cases where the origin information would be sensitive or unnecessary.
Broadly speaking, user agents add the Origin request header to:
GET or HEAD requests (i.e., they are added to same-origin POST, OPTIONS, PUT, PATCH, and DELETE requests).There are some exceptions to the above rules; for example, if a cross-origin GET or HEAD request is made in no-cors mode, the Origin header will not be added.
The Origin header value may be null in a number of cases, including (non-exhaustively):
http, https, ftp, ws, wss, or gopher (including blob, file and data).<img>, <video> and <audio> elements.createDocument(), generated from a data: URL, or that do not have a creator browsing context.Content-Security-Policy sandbox directive whose value doesn't include allow-same-origin.allow-same-origin.Referrer-Policy values, for requests that use neither GET nor HEAD and aren't made in cors mode (e.g., basic form posts). See Effect on the Origin header for the policy values that trigger this.Note: There is a more detailed listing of cases that may return null on Stack Overflow: When do browsers send the Origin header? When do browsers set the origin to null?
Origin: https://developer.mozilla.orgOrigin: https://developer.mozilla.org:80