Origin
is defined by:
scheme
(protocol)hostname
(domain)port
(if specified)All three needs to be identical to be considered a same origin
scheme/host/port
tupleSubpaths
of a URL does not contribute to the origin
:
# same origin http://example.com/app1/index.html http://example.com/app2/index.html
What doesn't matter:
/app1/index.html
/app2/index.html
What matters:
http://
is the scheme
example.com
is the host name
port
is omitted so both default to 80
and identicalDefault Port is 80
.
80
.# port to 80 http://example.com:80 # default port is 80 http://example.com
Different schemes
are different origins
:
# different protocol, different origins http://example.com/app1 https://example.com/app1
http
and https
are different protocols
/schemes
Subdomains
are different host names
:
# different origins http://example.com http://www.example.com http://myapp.example.com