Origin Header Explained
What the HTTP Origin header does and when it's used.
Published October 15, 2026
Origin sends the scheme, host and port that initiated a request. Servers use it for CORS and CSRF protection.
How it works
Unlike Referer it never includes a path. It is sent on cross-origin requests and non-GET same-origin requests.
The Origin header is part of the HTTP message and is case-insensitive in name.
In a real exchange
curl -i https://example.com/
Origin: https://app.example.com
Practical examples
The header
Origin: https://app.example.comSet or use it in code
if (!allowed.includes(req.get('Origin'))) return res.sendStatus(403)Inspect it
curl -sI https://example.com | grep -i 'origin'Common mistakes
- Reflecting any Origin back in Access-Control-Allow-Origin
- Treating a missing Origin as safe
- Allowing null origins
Key takeaways
- Origin: Origin sends the scheme, host and port that initiated a request.
- Check it in browser DevTools → Network.
- Test with curl -I before deploying.
FAQ
Origin vs Referer?
Origin has no path and is more privacy-friendly.
Is Origin case sensitive?
Header names are case-insensitive; values may not be.