Origin: where a request was initiated from
Origin states the origin of the page that initiated the request, without any path or query. It is set by the browser and page code cannot forge it.
At a glance
- Direction
- Request only, set by the browser.
- Defined in
- The Fetch standard (WHATWG), originally RFC 6454
- When absent
- The request may be same-origin, or from a client that is not a browser. Absence proves nothing on its own.
- Value
- Scheme, host and port only, for example https://app.example.com. Never a path.
- Sent on
- All cross-origin fetches, and on same-origin requests with an unsafe method such as POST
- Can be null
- For a sandboxed frame, a redirected cross-origin request, or a file opened from disk
- Cannot be set by
- Page code. It is on the forbidden header list.
In detail
Origin is the trustworthy half of the pair with Referer. It carries no path, so it leaks nothing about which page the visitor was on, and page code cannot override it because it sits on the browser's forbidden header list. That combination is what makes it usable in a security decision rather than only in analytics.
Browsers send it on every cross-origin fetch and also on same-origin requests using an unsafe method, which is why a plain form POST to your own site arrives with an Origin header. That behaviour is what allows a server to check the header on every state changing request without breaking ordinary navigation, which never carries one.
The value null appears more often than people expect: a sandboxed iframe without the allow-same-origin token, a page opened directly from the file system, and some redirect chains all produce it. Treating null as trusted is a real vulnerability, because an attacker can arrange for a request to carry it. Treat it as an unknown origin and refuse.
As a request forgery defence, compare the header against your own allowlist on every unsafe method and reject anything that does not match. It complements a token rather than replacing one, since a request from a non-browser client carries no Origin at all and has to be authorised some other way.
Examples
POST /api/items HTTP/1.1
Host: api.example.com
Origin: https://app.example.com
Content-Type: application/jsonAccess-Control-Allow-Origin: https://app.example.com
Vary: OriginThings that catch people out
- Origin has no path. Code that tries to match a full URL against it never matches anything.
- Treating a null origin as same-origin is exploitable, because a sandboxed frame can produce that value deliberately.
- An absent Origin is not proof of a same-origin request. Command line clients and older browsers send nothing at all.
Try it: HTTP Headers Checker
Check a live URL or paste headers you already have. It grades six security headers from A+ to F and lists every other header the response returned.
HTTP Headers Checker
LOCAL · Browser-OnlyView HTTP response headers for any URL
Enter any website URL to fetch and analyze its HTTP response headers. We'll automatically add https:// if needed.
Why Check Security Headers?
Security headers protect your website against common attacks like XSS, clickjacking, and MIME sniffing. They're set by your web server and cost nothing to implement. Missing security headers are one of the most common findings in security audits.
Related HTTP headers
All http headers →Access-Control-Allow-Origin: who may read this response
How the allow origin header is matched, why a wildcard fails with credentials, why it takes only one origin, and why Vary: Origin is mandatory when you echo.
Referrer-Policy: controlling what the Referer header leaks
Every Referrer-Policy value compared, what modern browsers do when the header is missing, and why URLs with tokens in them leak to third parties without it.
Sec-Fetch-Site and the Fetch Metadata request headers
What the browser tells your server about where a request came from and what it is for, and how to use Fetch Metadata headers to reject cross-site requests.
Host: which site the request is for
Why Host is mandatory in HTTP/1.1, how it maps to the authority in HTTP/2 and HTTP/3, and why trusting it to build URLs creates a real vulnerability.
Access-Control-Request-Method: the preflight question
What the browser sends on a preflight, which methods trigger one, why the server must answer with an exact match, and how to reproduce a preflight by hand.
Access-Control-Request-Headers: declaring custom headers
What the browser declares on a preflight, why the names arrive lowercase and sorted, which headers are omitted, and how to answer without guessing.
Tools for this
- HTTP Request Builder Free online HTTP request builder - build and test HTTP requests with custom headers and body
- HTTP Headers Checker Free online HTTP headers checker - view HTTP response headers for any URL