0

I tried to set up Google Cloud CDN for my server on Google Compute Engine. I have done everything correct but images on my server are not getting cached.

Cache hit ratio is n/a.

In logs, I am getting 200 status code for http://(ip address)/poweredby.png. So I am assuming frontend IP is not hitting my server but somewhere else. Other than this I can't find any error, all setup is correct. May be I have to change something in my nginx conf file? but I don't know. Let me know if question is not clear.

Update: I was using http but someone suggested https is must. So, i have updated it to https but now health check is getting failed. Thanks,

Rahul
  • 108
  • 1
  • 8
  • If you are hitting the IP directly and not a hostname, the GCP LB will not send a hostname to the backend server. In most cases, nginx will have a “default” site. Consider setting the “customRequestHeaders” field to a hostname matching a “server_name” field in your nginx config. Posting your nginx.conf, `gcloud compute (forwarding-rules, url-maps, target-http-proxies, backend-services) describe $NAME` output will help. – elithrar Sep 01 '19 at 16:00

1 Answers1

1

According to this documentation not all responses are cacheable. You need to meet all requirements for Cloud CDN to cache a response.

Regarding the HTTPS health checks: confirm that you have added 35.191.0.0/16 and 130.211.0.0/22 to your firewall rules. More information is in the documentation on GCP health checks.

Jeremy
  • 1,049
  • 1
  • 15
  • 28