Skip to content

Commit

Permalink
Merge pull request #6887 from readthedocs/cf-purging
Browse files Browse the repository at this point in the history
Add CloudFlare Cache tags support
  • Loading branch information
ericholscher committed Apr 13, 2020
2 parents 5b605e4 + 031735d commit c8aeb68
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion readthedocs/projects/signals.py
Expand Up @@ -12,7 +12,7 @@
project_import = django.dispatch.Signal(providing_args=['project'])

# Used to purge files from the CDN
files_changed = django.dispatch.Signal(providing_args=['project', 'files'])
files_changed = django.dispatch.Signal(providing_args=['project', 'version', 'files'])

# Used to force verify a domain (eg. for SSL cert issuance)
domain_verify = django.dispatch.Signal(providing_args=['domain'])
1 change: 1 addition & 0 deletions readthedocs/projects/tasks.py
Expand Up @@ -1837,6 +1837,7 @@ def _sync_imported_files(version, build, changed_files):
files_changed.send(
sender=Project,
project=version.project,
version=version,
files=changed_files,
)

Expand Down
2 changes: 2 additions & 0 deletions readthedocs/proxito/views/mixins.py
Expand Up @@ -126,6 +126,8 @@ def _serve_docs_nginx(self, request, final_project, version_slug, path, download
response['X-RTD-Version'] = version_slug
# Needed to strip any GET args, etc.
response['X-RTD-Path'] = urlparse(path).path
# Include the project & project-version so we can do larger purges if needed
response['Cache-Tags'] = f'{final_project.slug}-{version_slug},{final_project.slug}'
if hasattr(request, 'rtdheader'):
response['X-RTD-Version-Method'] = 'rtdheader'
if hasattr(request, 'subdomain'):
Expand Down

0 comments on commit c8aeb68

Please sign in to comment.