title: How to add "public" by default to cached views by Django?
body: <p>Im trying to use Google Cloud CDN to cache Django responses. Django properly sets the cache-control header with the max age, but it is missing the 'public' part of the header.</p>
  <p>Basically, currently all cached views have:</p>
  <pre><code>cache-control: max-age=3600
  </code></pre>
  <p>But I want:</p>
  <pre><code>cache-control: max-age=3600,public
  </code></pre>
  <p>Edit:
  My current settings.py have the following for caching:</p>
  <pre><code>MIDDLEWARE = [
      ...
      'django.middleware.cache.UpdateCacheMiddleware',
      'django.middleware.common.CommonMiddleware',
      'django.middleware.cache.FetchFromCacheMiddleware',
      ...
  ]
  
  ....
  
  CACHE_MIDDLEWARE_ALIAS = 'default'
  CACHE_MIDDLEWARE_SECONDS = 3600
  CACHE_MIDDLEWARE_KEY_PREFIX = ''
  CACHES = {
      &quot;default&quot;: {
          &quot;BACKEND&quot;: &quot;django_redis.cache.RedisCache&quot;,
          &quot;LOCATION&quot;: os.environ.get('CACHE_URL'),
          &quot;OPTIONS&quot;: {
              &quot;CLIENT_CLASS&quot;: &quot;django_redis.client.DefaultClient&quot;,
              &quot;IGNORE_EXCEPTIONS&quot;: True,
              &quot;MAX_ENTRIES&quot;: 10000,
          }
      }
  }
  </code></pre>
  <p>So I basically followed <a href="https://docs.djangoproject.com/en/3.1/topics/cache/" rel="nofollow noreferrer">https://docs.djangoproject.com/en/3.1/topics/cache/</a>. So I cached the entire site. And for those views which I don't want cached I use <code>@never_cache</code>.</p>
  <p>Edit 2:
  I could add &quot;public=True&quot; to each view with an annotation but I want a solution for the entire site.</p>