Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/amazon-web-services/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/321.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Amazon web services AmazonAPI网关自定义头_Amazon Web Services_Curl_Http Headers_Aws Api Gateway - Fatal编程技术网

Amazon web services AmazonAPI网关自定义头

Amazon web services AmazonAPI网关自定义头,amazon-web-services,curl,http-headers,aws-api-gateway,Amazon Web Services,Curl,Http Headers,Aws Api Gateway,我已经用AmazonGateway创建了一个API,但问题是,当我部署它时,它会对公众开放,所以我想创建一个自定义头,这样我就可以用这种方式调用API curl -X GET -H "X-custom-header" "amazon_api_gateway_url?some_param" 为此,我为API创建了一个GET资源,然后在方法请求中添加了一个HTTP请求头(即X-custom-Header)。但是,在部署API并尝试将其卷曲后,我得到一个{“message”:“禁止”}错误 使用此设

我已经用AmazonGateway创建了一个API,但问题是,当我部署它时,它会对公众开放,所以我想创建一个自定义头,这样我就可以用这种方式调用API

curl -X GET -H "X-custom-header" "amazon_api_gateway_url?some_param"
为此,我为API创建了一个GET资源,然后在方法请求中添加了一个HTTP请求头(即
X-custom-Header
)。但是,在部署API并尝试将其卷曲后,我得到一个
{“message”:“禁止”}
错误


使用此设置时您是否遇到过此错误?

您的目标是从外部世界保护您的API?如果是这样的话,那么将如何使用API网关的内置API密钥呢?是的,使用API密钥也是另一种选择。我找到了一种设置它的方法,但我不确定如何在requestIts中添加API键。看一看