Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
487 views
in Technique[技术] by (71.8m points)

http - Google Cloud App Engine gives Cannot Get / for the first request

I have a perfectly fine express node.js app that serves http requests. I put it on Google Cloud App Engine.

It serves the pages fine, but occasionally when I visit the page I get a white page that says:

Cannot Get /

if I refresh the page is served as usual.

This happens very often for my initial requests for the website. I use a custom domain.

How can I track this error, it doesn't show up in the log viewer. What is the cause of this?

app.yaml

runtime: nodejs12

env_variables:
  BUCKET_NAME: "example-gcs-bucket"

handlers:
- url: /.*
  secure: always
  script: auto

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Thanks for sharing additional information on the comments, we could discard any issues with your app.yaml file.

It seems that App Engine fails from time to time to add the CSP headers in their responses, making the message Content Security Policy of your site blocks some resources because their origin is not included in the content security policy header to be shown as found by John Hanley.

After some deep research it seems that this is a known issue and the GCP team is working to fix this. To mitigate this in the meantime you will need to set a policy as a HTTP header (recommended), or via an HTML <meta> tag following this Public blog.

I have created this Issue Tracker for you and the community to track the GCP team's progress. It includes the steps to diagnose the issue and the current workaround


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...