Uploaded image for project: 'Planet4'
  1. Planet4
  2. PLANET-5584

Serve images and pdf files through Cloudflare and greenpeace domain


    • Icon: Task Task
    • Resolution: Released
    • Icon: Should have Should have
    • 2.44.0
    • None
    • 5
    • Performance
    • Sprint #147, Sprint #148, Sprint #149

      Based on PLANET-2648 we want to "mask" storage.googleapis.com buckets urls to our own domain. This is extra important with Cloudflare, because we are missing the opportunity to serve these images through Cloudflare Edge servers. Instead we serve them from a US-located bucket. This results in significant slow responses for many regions away from US.

      The way some people deal with that is use a CNAME. But in order for that to work with https you need to set up a load balancer in GCP for each bucket. That doesn't scale for us, since we use a different bucket for each instance, so we would need to use a different CNAME for each one of them.

      A simpler workaround is to use a worker and proxy GCP buckets domain. Besides the obvious benefits, this also allows us to use some free image optimizations features in Cloudflare, that only work on images that come from the same domain as the website.


      • Create a new worker to be applied in www.greenpeace.net/static* that will proxy the requests to storage.googleapis.com.
      • The end result would be that an image that is accessible from storage.googleapis.com/planet4-<nro>stateless/<slug>.jpg will also be available from www.greenpeace.org/static/planet4<nro>-stateless/<slug>.jpg
      • Adjust the relevant setting ("File URL") in Stateless settings in all NRO websites. This may require flushing the cache.

            nroussos Nikos Roussos
            nroussos Nikos Roussos
            0 Vote for this issue
            1 Start watching this issue