gpt4 book ai didi

javascript - 谷歌应用引擎 CORS “Error parsing ./app.yaml: Unknown url handler type”

转载 作者:行者123 更新时间:2023-11-30 14:00:23 33 4
gpt4 key购买 nike

我正在尝试将 CORS 应用于我的应用引擎之一,但我遇到了错误。我试过查看其他答案(间距)的建议,但仍然出错:

应用.yaml

runtime: nodejs10

env_variables:
NODE_ENV: production
CLOUD_SQL_CONNECTION_NAME: domain-name-server:australia-southeast1:db_name

handlers:
- url: /.*
http_headers:
Access-Control-Allow-Origin: https://domain_name-fixed.appspot.com/

错误

ERROR: (gcloud.app.deploy) An error occurred while parsing file: [/home/project/domain_name-server/app.yaml]
Unknown url handler type.
<URLMap
secure=default
static_files=None
application_readable=None
auth_fail_action=redirect
require_matching_file=None
static_dir=None
redirect_http_response_code=None
http_headers={u'Access-Control-Allow-Origin': 'https://domain_name-fixed.appspot.com/'}
url=/.*
script=None
upload=None
api_endpoint=None
expiration=None
position=None
login=optional
mime_type=None
>
in "/home/project/domain_name-server/app.yaml", line 10, column 73

nodejs cors 设置

let cors = require("cors")

let origin =
[
"http://localhost:8080",
`http://${ip.address()}:8080`,
"http://localhost:4000",
`http://${ip.address()}:4000`,
"https://domain_name-fixed.appspot.com/"
]

app.use(cors({
origin,
credentials: true
}))

最佳答案

您只能为静态文件设置 HTTP header 。您需要在 nodejs 代码中完成 CORS 部分。

关于javascript - 谷歌应用引擎 CORS “Error parsing ./app.yaml: Unknown url handler type”,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56414634/

33 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com