Google App Engine:CloudStorageTools::getImageServingUrl 中的 URL 未缓存

Google App Engine: URL from CloudStorageTools::getImageServingUrl not cached

我正在使用 Google App Engine (GAE) 通过 CloudStorageTools::getImageServingUrl() 方法提供来自 Google 云存储 (GCS) 的图像。

这 return 是一张图片 URL 像:

https://lh3.googleusercontent.com/KE4x0Ptk8GbqkCqEcdBVkLF0ZpQceXGL1oL6C5be5zHSqpEGI_pceev1SjOFTHh1kj7zbzwHcFfFgh_6gSIA=s1600

此图像未缓存在浏览器中,因为它不是 return 正确的 expire/cache headers。我已经尝试在 GCS 中的 object 上设置缓存 headers:

Cache-control: public, max-age=1296000

...以及 GAE 配置文件的缓存设置 app.yaml:

default_expiration: "4d 5h"

...哪个展位似乎对图像的投放没有影响。对于通过 CloudStorageTools::getImageServingUrl() 方法提供的 URL 服务的图像,有什么方法可以控制缓存 headers?

谢谢!

T

正如我在评论中提到的,这可以通过“-e31”标志实现(在本例中为 31 天)。此外,它可以通过 nginx 反向代理设置来实现(如果您需要对 headers 进行更多控制,这很有用)。我在 post Google App Engine getImageServingUrl with download file name 中的回答显示了一个例子。