【发布时间】:2021-05-05 14:14:16
【问题描述】:
所以我使用 kong 作为 API 网关。我在 aws 返回标头上有一个简单的 lambda 函数。我能够看到来自 aws lambda 函数的响应,但是没有相关 ID。我已将相关 ID 插件设置为全局。希望澄清一下为什么 lambda 插件没有在原始响应的标头中添加相关 ID。
exports.handler = async (event) => {
// TODO implement
const response = {
statusCode: 200,
body: JSON.stringify(event.request_headers),
};
return response;
};
我的 kong.yaml
_format_version: "1.1"
routes:
- name: lambda1
paths:
- /lambda1
path_handling: v0
preserve_host: false
protocols:
- http
- https
regex_priority: 0
strip_path: true
https_redirect_status_code: 426
plugins:
- name: aws-lambda
config:
aws_key: XXXXXXXXXXXXXXXXXXXXXXX
aws_region: us-east-1
aws_secret: XXXXXXXXXXXXXXXXXXXXXXXXx
awsgateway_compatible: false
forward_request_body: true
forward_request_headers: true
forward_request_method: false
forward_request_uri: false
function_name: kong-lambda-plugin
host: null
invocation_type: RequestResponse
is_proxy_integration: false
keepalive: 60000
log_type: Tail
port: 443
proxy_scheme: null
proxy_url: null
qualifier: null
skip_large_bodies: true
timeout: 60000
unhandled_status: null
enabled: true
protocols:
- grpc
- grpcs
- http
- https
plugins:
- name: correlation-id
config:
echo_downstream: false
generator: uuid#counter
header_name: correlation-id
enabled: true
protocols:
- grpc
- grpcs
- http
- https
【问题讨论】:
-
你能分享一个最小的配置来检查你做了什么吗?
-
我添加了我的kong.yaml,我的假设是aws lambda插件的优先级在correlation-id插件之前
-
不要分享你的秘密
标签: aws-lambda kong