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,
1 Answers
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.
- 138