Some pictures could not be reachable from browser while we cache them with CDN of CF


#1

Hi there,

Some pictures could not be reachable from browser while we cache them with CDN of CF.
We use CDN feature of CF for our website, both pc and mobile versions. For some static files, like images, the files for both pc and mobile versions are located in the same uri and share the same name, but with different size, while the domain for pc and mobile versions are the same.
Let me take an instance. Users want to visit a pic with url like https://www.xxx.com/pic/example.jpg, they could visit it both on pc and mobile phones but actually goes to different location on the server side. And now it often happens that we could not get the pics from the browsers.


Pictures could not be reachable when we cache them on CDN of CF
#2

Hi there,

As we use CDN feature of CF for our website, which has both pc and mobile versions.
Some static files are located on different section of server side, but with the same file name and url when someone wants to visit them via browsers.
Let me take an example. Someone could visit pic1 via https://www.xxx.com/root/pic1 both for pc and mobile versions, but on server side, the pic1 of pc and mobile versions are located differently with the same file name but different size. And now, we often could not get the pic1 when we visit it from browsers.
What could be wrong here?


#3

If you are serving 2 different images with the same URI by default Cloudflare will not distinguish between them, the logic that is retrieving 2 different images or that the images should even be different is being managed by your server.

Options I can think of:

  1. Don’t cache those images/ paths.
  2. Use Cloudflare Workers to handle that logic.
  3. Use custom cache keys (Enterprise only)
  4. Use different paths for the images for different device types.

#4

This topic was automatically closed after 14 days. New replies are no longer allowed.