title: What is the 2015 method for configuring a cookieless domain for serving static content?
body: <p>I'm trying to serve static content from a cookieless domain. I've created a separate domain altogether for this purpose (not a subdomain with a CNAME setting, etc.), and have created a simple PHP file for testing the difference in retrieval time for grabbing image files, in this case the same image 10,000 times:</p>
  
  <pre><code>&lt;?php
  echo '&lt;!DOCTYPE html&gt;';
  // Here I can toggle between grabbing the static content from the static domain with the specially edited .htaccess file, or from the main domain, just by remming out one line and unremming the other:
  $source = "http://MY-STATIC-DOMAIN.com/";
  //$source = "http://MY-DYNAMIC-DOMAIN.COM/"
  
  $before = microtime(true);
  $output = '&lt;img style="display: none;" src="' . $source  . 'images/TEST-IMAGE.jpeg "  height="400" width="311"/&gt;';
  
  for ($i=0 ; $i&lt;10000 ; $i++) {
      echo $output;
  }
  
  $after = microtime(true);
  $timex = ($after-$before);
  echo $timex;
  ?&gt;
  </code></pre>
  
  <p>The trick is to configure the static domain NOT to receive cookies (RIGHT?) Better yet would be a way to configure the origin/dynamic domain not to SEND cookies, but I can't see a way to do that on a case-by-case basis (or especially with any inline code, which would seem to be ideal...there's a third-party web proxy called PRIVOXY that would seem to offer this benefit, but I'd prefer not to have to rely on anything that I could simply code directly in the .htaccess file).</p>
  
  <p>In any case, there's only scant information online about how to do this by editing the .htaccess file of the STATIC domain, and the suggested code for the .htaccess file runs from the incredibly simple:</p>
  
  <pre><code>Header unset Cookie
  Header unset Set-Cookie
  </code></pre>
  
  <p>...to the mind-bendingly complex:</p>
  
  <pre><code># Use Mod_deflate to compress static files
  &lt;ifmodule mod_deflate.c&gt;
      &lt;filesmatch ".(js|css|ico|txt|htm|html|php)$"&gt;
          SetOutputFilter DEFLATE
      &lt;/filesmatch&gt;
  &lt;/ifmodule&gt;
  
  # Speed up caching
  FileETag MTime Size
  
  # Expires
  ExpiresActive On
  ExpiresDefault "access plus 366 days"
  
  # Future Expires Headers
  &lt;filesmatch ".(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$"&gt;
      Header set Expires "Sat, 27 Dec 2014 23:59:59 GMT"
  &lt;/filesmatch&gt;
  </code></pre>
  
  <p>Yet, no matter which instructions I place into the .htaccess file of the STATIC domain that is housing the JPEG file that I'm calling repeatedly in my test, the time difference is neglible, and in some cases retrieving the static content from the origin/dynamic site is faster.</p>
  
  <p>Have I devised my test file incorrectly? Or is there a better set of .htaccess instructions than the two competing ones above (and I've found others...I've been testing this for hours, both on my local server and on my live sites). </p>
  
  <p>I've also read the study in which it seemed proven that serving minified .CSS files from the primary domain itself is faster than retrieving them from a static domain, but the author concedes at the conclusion of the article that images are still best served from a static domain:</p>
  
  <p><a href="http://www.jonathanklein.net/2014/02/revisiting-cookieless-domain.html" rel="nofollow">http://www.jonathanklein.net/2014/02/revisiting-cookieless-domain.html</a></p>
  
  <p>Many thanks in advance from any guru who can point me in the right direction (especially as regards not sending out a cookie with the content request in the first place, which would benefit from an in-line command in the HTML, I would reckon).</p>