How do I setup IIS with a cookieless domain to improve performance?

Keltex picture Keltex · Jun 5, 2009 · Viewed 15.3k times · Source

I was reading in google's documentation their new pagespeed plugin, that they recommend using cookieless domains to improve performance:

Static content, such as images, JS and CSS files, don't need to be accompanied by cookies, as there is no user interaction with these resources. You can decrease request latency by serving static resources from a domain that doesn't serve cookies.

Does anybody know how to do this in IIS?

Answer

Kev picture Kev · Jun 5, 2009

What the Google article is suggesting is that you serve all your static content from another domain where cookies are not initially set by that serving domain.

Cookies are set in two ways - by session cookies (e.g. by ASP or ASP.NET requests) or explicitly by your application.

These will be posted back TO the server on each subsequent request for the domain that set the cookie (regardless of whether the request is for static or dynamic content) thus increasing the request payload.

What you're doing by having a second domain to serve static content (HTML, CSS, Images etc) is making cookie free requests because no initial cookie would be set in the first place for that domain.

In IIS it's your application, ISAPI Filter or ISAPI extension that will add a cookie. If your IIS server is not intercepting requests for static content (because this is usually handled by the kernel mode http.sys driver) then no cookies will be added to the response. It's only further up the request pipeline that cookies come into play.

So basically there isn't a way to explicitly configure cookie-less domains in IIS.