3 ms·
56% Serving CSS with Cookies? Wow. I must have missed this wave of innovation. I honestly have never heard of this before.
by wyuenho 16y ago
56% Serving CSS with Cookies? Wow. I must have missed this wave of innovation. I honestly have never heard of this before.
- istjohn 16y agoCookies are usually served by default with any http communication, including serving CSS files.
- wyuenho 16y agoWell no. I think you must have confused HTTP headers with Cookies. Cookies are "set" by the server, usually only once per value, and then "sent" back from the client on every request. Cookies are an extension of HTTP, it's not served, whether by the client or the server, on any HTTP communication. It's only sent back by the client when it needs to tell the server it is maintaining a certain state. In the case of CSS, there's no state to maintain, so Cookies are certainly supposedly useless. For details, I refer you to RFC 2965. I'm not sure what exactly what Steve Souders means when he wrote "serve CSS with Cookies". It sounds like 56% of the population piggyback CSS in the Cookie values...
- pistoriusp 16y agoIf you're serving static media on a domain that also serves cookies then each request to the static media will include the cookie request. Generally you can serve cookies on www.example.com and not have request to example.com include cookies.
- wyuenho 16y agoRight, but how is this a problem that you can control? It's the client that sends back the cookies, not the server, and you can't control your clients. When you need to set a cookie, you just do. I think this number needs some sort of clarifications from Steve Souders as to what he means.
- jasonkester 16y agoYes, this is a problem you can (and should) control. It's as simple as registering mysitecdn.com (assuming your main domain is mysite.com) and serving all static content from there. Never set cookies against your CDN domain and they will never be in your users browser, thus ensuring he won't send them back to you with every request.
- wyuenho 16y agoAh ha this makes more sense. So if I don't want to use a real CDN, I can just set my cookies with a domain www.mysite.com, serve all my static content from cdn.mysite.com and I'm all set?
- pistoriusp 16y ago100% correct. Just some clarification for those that don't get it. Setting cookies on mysite.com; means that the cookies will be pushed by the client for all subdomains for mysite.com (*.mysite.com); -- But if you're setting cookies from www.mysite.com you can serve media from cdn.mysite.com and the requests from cdn.mysite.com will not push cookies to your server.