-1

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 fronend 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 idk. Let me know if question is not clear. Thanks,

closed as off-topic by womble Aug 12 at 3:13

This question appears to be off-topic. The users who voted to close gave this specific reason:

If this question can be reworded to fit the rules in the help center, please edit the question.

1

There are a couple things going on here which are causing you issues, to begin with, the server object you are attempting to cache the image from is not on Google’s network: IP 47.78.15.243 is held by Alibaba.

With Cloud CDN, not all HTTP responses are cacheable. Cloud CDN caches only those responses that meet certain requirements. Some of these requirements are specified by RFC 7234, and others are specific to Cloud CDN.

Most notably for your case, the data to be cached would need to be served by a HTTP(S) backend service or backend bucket (inside of Google Cloud) with Cloud CDN enabled. With Cloud CDN you also must use HTTP(S) load balancing (within Google Cloud) as the origin of content cached by Cloud CDN.

You can find more details about CDN used with Google Cloud Platform here.

  • Sorry i forgot to mention that IP is wrong , i changed it just to be secure . real frontend ip is correct one . I am using http load balancer , i will change it to https and will try again. thanks, – Rahul Aug 12 at 7:24
  • I have setup load balancer with https. Now my health check is getting failed. Would you guide me what to do next? – Rahul Aug 14 at 20:32
  • As you have an HTTP(S) LB, I am suspecting you have http(s) health check for the backends. If that is the case, as indicated in the health check is expecting HTTP 200 OK responses to consider them as healthy. Review the responses of your web servers also make sure you created the health check according to the official guide. – Nur Aug 20 at 0:17
  • Additionally, the troubleshooting guide will also help you identify and correct any problems. Note that you might need to add ingress rules to your GCP firewall allowing the traffic from the IP ranges used by the GCP probe systems to the port the health check will test on the backend instances. – Nur Aug 20 at 0:18

Not the answer you're looking for? Browse other questions tagged or ask your own question.