我正试图在部署脚本中使用aws-cli从命令行设置aws CORS。 我使用以下perl命令来创建POST资源。 我试图设置集成响应'*'很像启用核心会做的。api网关CORS设置
aws apigateway put-method-response \\ --region "$region" \\ --rest-api-id "$api_id" \\ --resource-id "$resource_id" \\ --http-method "POST" \\ --status-code 200 \\ --response-models '{"application/json":"Empty"}' \\ --response-parameters '{"method.response.header.Access-Control-Allow-Origin":true}'
当我运行下面的命令来设置的积分值。
aws apigateway put-integration-response \\ --region "$region" \\ --rest-api-id "$api_id" \\ --resource-id "$resource_id" \\ --http-method "$method" \\ --status-code 200 \\ --response-template '{"application/json":"Empty"}' \\ --response-parameters \\ '{"method.response.header.Access-Control-Allow-Origin": "'*'"}'
我碰到下面的错误。无效的映射表达式规定:验证结果:警告:[],错误:指定了无效的映射表达式:*]
谁能告诉我这是什么
客户端错误(BadRequestException)调用PutIntegrationResponse操作时发生错误实际上是指api网关部署脚本,甚至是更好的方法。
太棒了,很高兴它解决了! –