Cloudflare

Our CDN piece of infrastructure, tunneling all traffic to P4 websites

Configuration

All the permanent settings in Cloudflare are managed by code (Terraform) and deployed through GitLab CI.

Any change to our Cloudflare assets and their respective configuration should happen through code.

Workers

We are using a few Cloudflare workers for applying certain functionality on specific routes/urls. The workers deployment is also managed in code and deployed by CircleCI.

Static files

This worker is responsible for proxying 4 static files (practically anything from the Media Library) from GCP buckets. The worker in practice does the following things:

  • Masks default GCP url (storage.googleapis.com) with one of our own (www.greenpeace.org/static/) branding reasons.

  • Using our own domain, also allow us to use Cloudflare's Polish feature for optimizing images, since it can ony be applied in a domain we own.

  • Since the files are now served from our domain they are also cached by Cloudflare in its edge servers, which are closer to end user location.

  • We also have the option to adjust headers if needed. Currently we decrease browser cache for pdf files to ensure end users don't get an older version when a file is replaced with a new one.

Robots

This worker is responsible for rendering a robots.txt file to ensure dev and staging are not indexed by search engines.

Homepage

This worker is responsible for rendering the Planet 4 homepage.

Last updated