aka
aka
GET /world.html HTTP/1.1
Host: www.hello.com
Accept: image/gif, image/jpeg, */*
Accept-Language: en-us
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)
URL: Uniform Resource Locator
Protocol
Path
Host
Method/Verb
Headers
HTTP/1.1 200 OK
Last-Modified: Thu, 14 May 2009 16:26:47 GMT
Content-Type: text/html
<!DOCTYPE html>
<html>
<head><link src="./styles.css" /></head>
<body><img src="./hi.gif" /></body>
</html>
Response Headers
Response Body
More Resources
Status Code
aka
good.com
Please give us your credit card:
123
good.com server
PUT /credit-card-number HTTP 1.1
Host: good.com
{number: 123}
evil.com
Here's some harmless cat pics for you:
GET /credit-card-number
Host: good.com
200 OK
{number: 123}
evil.com server
PUT /credit-card-number HTTP 1.1
Host: evil.com
{number: 123}
Origin: http://www.hello.com
Access-Control-Request-Method: PUT
Access-Control-Allow-Origin: http://www.hello.com
Access-Control-Allow-Methods: GET, POST, PUT
Automatically inserted by browser
Have to be set explicitly by server
Origin: http://www.world.com
Access-Control-Request-Method: PUT Host: http://www.hello.com
Access-Control-Allow-Origin: http://www.hello.com,
http://www.world.com
Access-Control-Allow-Methods: GET, POST, PUT
Where does the request come from?
Where does the request go to?
aka
Access-Control-Allow-Origin: http://www.hello.com,
http://www.world.com
Access-Control-Allow-Methods: GET, POST, PUT
Access-Control-Allow-Origin: http://www.hello.com,
http://www.world.com
Access-Control-Allow-Methods: GET, POST, PUT, OPTIONS
Request:
OPTIONS /hello.html HTTP/1.1
Access-Control-Request-Method: DELETE
Access-Control-Request-Headers: origin, x-requested-with
Origin: https://www.evil.com
Response
HTTP/1.1 200 OK
Content-Length: 0
Connection: keep-alive
Access-Control-Allow-Origin: https://www.evil.com
Access-Control-Allow-Methods: POST, GET, OPTIONS, DELETE
Access-Control-Max-Age: 86400
Access-Control-Allow-Origin: * Access-Control-Allow-Methods: GET, POST, PUT, OPTIONS
Wildcard that allows ALL origins.