title: Can you use gzip over SSL? And Connection: Keep-Alive headers
body: <p>I'm evaluating the front end performance of a secure (SSL) web app here at work and I'm wondering if it's possible to compress text files (html/css/javascript) over SSL.  I've done some googling around but haven't found anything specifically related to SSL.  If it's possible, is it even worth the extra CPU cycles since responses are also being encrypted?  Would compressing responses hurt performance?</p>
  
  <p>Also, I'm wanting to make sure we're keeping the SSL connection alive so we're not making SSL handshakes over and over. I'm not seeing <strong>Connection: Keep-Alive</strong> in the <strong>response</strong> headers.  I do see Keep-Alive: 115 in the <strong>request</strong> headers but that's only keeping the connection alive for 115 milliseconds (seems like the app server is closing the connection after a single request is processed?)  Wouldn't you want the server to be setting that <strong>response</strong> header for as long as the session inactivity timeout is?</p>
  
  <p>I understand browsers don't cache SSL content to disk so we're serving the same files over and over and over on subsequent visits even though nothing has changed.  The main optimization recommendations are reducing the number of http requests, minification, moving scripts to bottom, image optimization, possible domain sharding (though need to weigh the cost of another SSL handshake), things of that nature.</p>