docs.rodeo

MDN Web Docs mirror

Origin

{{HTTPSidebar}} 

The HTTP Origin {{Glossary("request header")}}  indicates the {{glossary("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 `{{Glossary("Request header")}}` 
`{{Glossary("Forbidden header name")}}`  Yes

Syntax

Origin: null
Origin: <scheme>://<hostname>
Origin: <scheme>://<hostname>:<port>

Directives

Description

The Origin header is similar to the {{HTTPHeader("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:

There are some exceptions to the above rules; for example, if a cross-origin {{HTTPMethod("GET")}}  or {{HTTPMethod("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):

[!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?

Examples

Origin: https://developer.mozilla.org
Origin: https://developer.mozilla.org:80

Specifications

{{Specifications}} 

Browser compatibility

{{Compat}} 

See also

In this article

View on MDN