I am using Google Cloud Load Balancing with CDN for optimizing load on my server and improving response time for static pages.
I was successfully able to set it up for serverless NEGs (AppEngine specifically) but I am unable to set it for internet NEGs.
ISSUE
The CDN does not cache the reponses from my WPEngine served website even with Force cache all content setting. The website is static (with php generated pages). My WPEngine is already has caching with reverse proxy (can this be a problem?) but I wanted to optimize it even further Google's Edge infrastructure.
These are the caching headers with and without Google Load Balancer(with CDN).
Without Google Load Balancer
Server →nginx
Date →Wed, 11 Nov 2020 06:29:03 GMT
Content-Type →text/html; charset=UTF-8
Transfer-Encoding →chunked
Connection →keep-alive
Keep-Alive →timeout=20
Vary →Accept-Encoding
Vary →Accept-Encoding
Vary →Accept-Encoding,Cookie
Link →<https://xxxxxxxxx/wp-json/>; rel="https://api.w.org/"
X-Powered-By →WP Engine
X-Cacheable →SHORT
Cache-Control →max-age=600, must-revalidate
X-Cache →HIT: 1
X-Cache-Group →normal
Content-Encoding →gzip
With Google Load Balancer(with CDN enabled)
Server →nginx
Date →Wed, 11 Nov 2020 06:30:01 GMT
Content-Type →text/html; charset=UTF-8
Vary →Accept-Encoding,Accept-Encoding,Cookie
Link →<https://xxxxx-cdn.xxxxxx.com/wp-json/>; rel="https://api.w.org/"
X-Powered-By →WP Engine
X-Cacheable →SHORT
X-Cache →MISS
X-Cache-Group →normal
Content-Encoding →gzip
Via →1.1 google
Alt-Svc →clear
Cache-Control →public,max-age=3600
Transfer-Encoding →chunked
The AGE header should be there for the CDN enabled request but it is missing showing a cache miss.