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?