title: GAE: Enabling Edge Cache with webapp2 (Python)
body: <p>There has been this new video on youtube demonstrating the strength of EdgeCaching in the GAE architecture, and at this particular point in the video they demonstrate how easy it is to leverage:
  <a href="http://www.youtube.com/watch?v=QJp6hmASstQ#t=11m12" rel="nofollow">http://www.youtube.com/watch?v=QJp6hmASstQ#t=11m12</a></p>
  
  <p>Unfortunately it's not that easy...</p>
  
  <p>I'm looking to enable edge caching using the webapp2 framework provided by Google.</p>
  
  <p>I'm calling: </p>
  
  <pre><code>self.response.pragma = 'Public'
  self.response.cache_expires(300)
  </code></pre>
  
  <p>but it seems overridden by something else.</p>
  
  <p>The header I get is:</p>
  
  <pre><code>HTTP/1.1 200 OK
  Pragma: Public
  Cache-Control: max-age=300, no-cache
  Expires: Sat, 23 Feb 2013 19:15:11 GMT
  Content-Type: application/json; charset=utf-8
  Content-Encoding: gzip
  X-AppEngine-Estimated-CPM-US-Dollars: $0.000085
  X-AppEngine-Resource-Usage: ms=39 cpu_ms=64
  Date: Sat, 23 Feb 2013 19:10:11 GMT
  Pragma: no-cache
  Expires: Fri, 01 Jan 1990 00:00:00 GMT
  Cache-Control: no-cache, must-revalidate
  Vary: Accept-Encoding
  Server: Google Frontend
  Content-Length: 600
  </code></pre>
  
  <p>I'm using ndb top level:</p>
  
  <pre><code>app = ndb.toplevel(webapp2.WSGIApplication(...
  </code></pre>
  
  <p>I tried the technics explained here, but they don't seem to apply to webapp2:
  <a href="http://code.google.com/p/googleappengine/issues/detail?id=2258#c14" rel="nofollow">http://code.google.com/p/googleappengine/issues/detail?id=2258#c14</a></p>
  
  <p>I also looked at this post too:
  <a href="https://groups.google.com/d/topic/webapp2/NmHXoZZSVvo/discussion" rel="nofollow">https://groups.google.com/d/topic/webapp2/NmHXoZZSVvo/discussion</a></p>
  
  <p>I tried to set everything manually with no success. Something is overriding my cache settings.</p>
  
  <p>Is there a way to make it work with webapp2? Any other option is welcome.</p>
  
  <p><strong>EDIT:</strong> I'm using an url with version prefix: <a href="http://version.appname.appspot.com" rel="nofollow">http://version.appname.appspot.com</a> and it's probably the cause of my problem.</p>