【问题标题】:file doesn't want to be parse ( app.yaml Google Cloud Platoform - App Engine context )文件不想被解析(app.yaml Google Cloud Platform - App Engine context)
【发布时间】:2019-08-05 10:48:59
【问题描述】:

我想添加一个 http 标头访问控制允许来源,以使我的应用与 CORS 兼容。我是在 app.yaml 文件中完成的,但是当我尝试部署我的服务器时,它使我出现解析错误。

解析文件时出错

这是我的 app.yaml

runtime: nodejs
env: flex

skip_files:
  - ^node_modules$

handlers:
  - url: /generate
    http_headers:
      Access-Control-Allow-Origin: http:/localhost:3000

请问有人有想法吗?我认为我尊重缩进。

谢谢:)

【问题讨论】:

  • 尝试在http_headers 之前添加-(破折号)
  • 我试过了,但还是不行:/ 在 gcp 文档中,我正在写它
  • 您的网址中缺少/http://localhost:3000

标签: google-app-engine google-cloud-platform yaml


【解决方案1】:

为避免解析错误,您需要包含 directory of the shared resources:

handlers:
- url: /generate
  static_dir: static/whatever
  http_headers:
    Access-Control-Allow-Origin: http://localhost:3000

【讨论】:

    猜你喜欢
    • 2015-01-28
    • 2019-06-13
    • 1970-01-01
    • 2017-08-24
    • 2020-03-19
    • 1970-01-01
    • 2013-04-09
    • 1970-01-01
    • 2015-07-07
    相关资源
    最近更新 更多