2

I am developing an application on Google AppEngine (Java) that generates a HTML report. The report gets viewed frequently and modified occasionally, and I am thinking to optimize the performance by scheduling the report to be generated and uploaded to Google Cloud Storage, and have that serve the report instead of AppEngine. So, userA and userB can create reports and access them from userA-report.myapp.com and userB-report.myapp.com, where the content is generated in AppEngine and stored in Cloud Storage.

I, however, have a few constraints: - Some of the reports had access restrictions, which I would like to be controlled by my application still; in the other words, I don't want to use the ACL and maintain that for restricting access; - I do not have a way to dynamically configure my CNAME entries; so, I still need to handle the request on AppEngine and redirect to Cloud Storage.

I am thinking what I can do is if I detect that the report is already available on Cloud Storage, I send a HTTP 3XX redirect to http://storage.googleapis.com -- I realize that this is not as performant since it involves another trip, but should still be faster than generating the page again. I can also handle any authentication as needed.

Besides the concern I had above for performance, this sounds "backwards" to me to go to the content server first, then redirect to CDN; Is there a way in Cloud Storage to configure in cases where a file is not found, it hits a different server? Or is my approach completely pointless?

4

1 回答 1

2

首先,对于访问限制问题,首先访问您的服务器并重定向到 storage.googleapis.com 是一种非常合理的方法。您可能还想考虑使用签名 URL。使用此功能,无需在对象上设置 ACL 以进行访问控制,只需将 ACL 保持为私有并在您决定用户应该具有访问权限时创建限时签名 URL。

对于关于何时找不到文件的第二个问题,您可以使用带有自定义 NotFoundPage的网站配置功能。这可以是一个 HTML 文件,因此您可以使用它来重定向到您的应用程序服务器。

于 2013-07-17T15:55:26.660 回答