Strapi Automatic Scaling on Google App Engine

For anyone else reading this in future. The code the OP posted above does work just don’t expect to be able to access /_ah/warmup from your browser to check to see if it works.

Instead, depend on the GCP Logs. You can use protoPayload.wasLoadingRequest="true" as a log filter to see your cold start requests, as long as /_ah/warmup is returning 200 responses on there it kind of doesn’t matter if you can reach it from your browser or not.

I think the issue in the browser may be related to the HSTS header that Strapi sets for you by default. Either that or the secure: optional directive that is the default for app.yaml.

I had some success with altering my app.yaml to secure: never in order to see the warmup request in the browser but I don’t want to suggest that for anything other than dev work, certainly not production.

Changing it to secure:always and deploying again means I can’t see /_ah/warmup in my browser (I get that aforementioned redirect issue) but I do see it being successful in the GCP logs.