Harvard Extension School
CSCI E-12 Fundamentals of Web Site Development | Fall 2019

## Cookie Example

- Server returns cookie to HTTP client ("Set-Cookie" response header)
- HTTP client returns cookie to server ("Cookie" request header)

`GET http://espn.com/`

    GET http://espn.com/ --> 301 Moved Permanently
    GET http://www.espn.com/ --> 301 Moved Permanently
    GET http://espn.go.com/ --> 200 OK

    Cache-Control: max-age=4
    Date: Tue, 05 May 2015 21:29:54 GMT
    Vary: User-Agent,Cookie, Accept-Encoding
    Content-Type: text/html;charset=utf-8
    Access-Control-Allow-Origin: *
    Client-Date: Tue, 05 May 2015 21:29:54 GMT
    Client-Peer: 68.71.212.186:80
    Client-Response-Num: 1
    Client-Transfer-Encoding: chunked
    P3P: CP="CAO DSP COR CURa ADMa DEVa TAIa PSAa PSDa IVAi IVDi CONi OUR SAMo OTRo BUS PHY ONL UNI PUR COM NAV INT DEM CNT STA PRE"
    Set-Cookie: SWID=14A94FD2-4C96-4297-AD59-45B5BB7A8B67; path=/; expires=Mon, 30 Apr 2035 21:29:54 GMT; domain=go.com;
    Set-Cookie: device=pc; path=/; Expires=Thu, 04 Jun 2015 21:29:54 GMT;

### ESPN Cookies

`Set-Cookie: SWID=14A94FD2-4C96-4297-AD59-45B5BB7A8B67; path=/; expires=Mon, 30 Apr 2035 21:29:54 GMT; domain=go.com;`

`Set-Cookie: device=pc; path=/; Expires=Thu, 04 Jun 2015 21:29:54 GMT;`

Copyright © David Heitmeyer