1

我正在试验zappa,以便将 Flask 应用程序部署到 API Gateway + Lambda 代理。

但是,我没有Content-Type在我的应用程序中收到标题,甚至没有像我在其他答案中看到的那样小写。

我是否需要配置任何特定于此标头的内容?其他标头无需配置即可传递给我的应用程序,例如:

curl -X POST \
    -H "Content-Type: application/x-www-form-urlencoded" \
    -H "Authorization: this-reaches-lambda" \
    -H "MyCustomHeader: this-reaches-lambda" \
    -d "username=myUsername&password=myPassword" \
    "https://myurl.myregion.amazonaws.com/api/"

这些是我在 lambda 中收到的标头:

[1524670029998] Content-Length: 52
[1524670029998] Accept: */*
[1524670029998] Authorization: this-reaches-lambda
[1524670029998] Cloudfront-Is-Tablet-Viewer: false
[1524670029998] Cloudfront-Viewer-Country: BR
[1524670029998] Host: myurl.amazonaws.com
[1524670029998] User-Agent: curl/7.54.0
[1524670029998] Via: 2.0 mycloudfronturl.cloudfront.net (CloudFront)
[1524670029998] X-Amz-Cf-Id: Kws-G0M3QPyOZwTOCkP7psJi5Cf5B8ZVRd9luBjV0dOTFhYNVBtedQ==
[1524670029998] X-Amzn-Trace-Id: Root=1-5ae09e4d-cf432adedfa115383616168e
[1524670029998] X-Forwarded-For: myip, otherIp
[1524670029998] X-Forwarded-Port: 443
[1524670029998] X-Forwarded-Proto: https
[1524670029998] Cloudfront-Forwarded-Proto: https
[1524670029998] Cloudfront-Is-Desktop-Viewer: true
[1524670029998] Cloudfront-Is-Mobile-Viewer: false
[1524670029998] Cloudfront-Is-Smarttv-Viewer: false
[1524670029998] MyCustomHeader: this-reaches-lambda
4

0 回答 0