If you’re ever stuck wondering why Live HTTP Headers and Firebug are telling you your “Cookie:” request headers don’t match the “Set-Cookie:” response headers you’ve just been sent, here’s a couple of points and gotchas worth remembering:
- A cookie can only be overwritten (or deleted) by a subsequent cookie exactly matching the name, path and domain of the original cookie. Even though a cookie with domain “.example.org” set by www.example.org is perfectly valid, it will not overwrite a previous cookie of the same name which was set against “www.example.org”. Instead, both cookies will be stored, and on subsequent requests only one will be sent.
- If multiple cookies of the same name match a given request URI, one is chosen by the browser.
The more specific the path, the higher the precedence. However precedence based on other attributes, including the domain, is unspecified, and may vary between browsers. This means that if you have set cookies of the same name against “.example.org” and “www.example.org”, you can’t be sure which one will be sent back.
- The HTTP state object is called a cookie
for no compelling reasonaccording to the preliminary specification from Netscape.
SitePoint WordPress Restaurant Theme
Pull in the crowds to your eatery, cafe, restaurant or bar with this flexible, modular WordPress theme.
SitePoint WordPress Ecommerce Theme
Sell your wares with this delightfully elegant WooCommerce-powered WordPress theme.
SitePoint WordPress Portfolio Theme
A beautiful, responsive, portfolio theme for creatives - photographers, designers, writers, developers - that shows off your skills and work to potential clients.
Responsive Web Development
Build a modern website with maximum efficiency and organization
Elm: A Beginners' Guide to Elm and Data
Elm, a front-end functional programming language for web apps
Tighten up your programming with strong typing, through TypeScript
Designing UX: Prototyping
A prototype is worth a thousand words
Researching UX: Analytics
Understanding is at the heart of good UX
Rails: Novice to Ninja
The ultimate beginner's guide to Rails!