Skip to content

Commit

Permalink
Add "Cache-Control: no-cache" for redirects to badges
Browse files Browse the repository at this point in the history
Related #1612
  • Loading branch information
gregmuellegger committed Sep 14, 2015
1 parent b2b6d03 commit 8ba7f92
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions readthedocs/projects/views/public.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
from django.http import HttpResponse, HttpResponseRedirect, Http404
from django.shortcuts import get_object_or_404, render_to_response
from django.template import RequestContext
from django.views.decorators.cache import cache_control
from django.views.generic import ListView, DetailView
from django.utils.datastructures import SortedDict
from django.views.decorators.cache import cache_page
Expand Down Expand Up @@ -120,6 +121,7 @@ def _badge_return(redirect, url):

# TODO remove this, it's a temporary fix to heavy database usage
@cache_page(60 * 30)
@cache_control(no_cache=True)
def project_badge(request, project_slug, redirect=True):
"""Return a sweet badge for the project"""
version_slug = request.GET.get('version', LATEST)
Expand Down

0 comments on commit 8ba7f92

Please sign in to comment.