amazon-web-services - 如何根据 AWS API Gateway 中的请求标头动态设置集成端点?
问题描述
我想根据请求中收到的请求标头将传入请求代理到不同的端点。
在 AWS API 网关中,我可以将不同的端点设置为单独的阶段变量,但在集成 >> 端点 URL 设置中,我想根据请求标头值的值选择阶段变量。
例如:
如果标头值为 brand-id: abc 那么请求应该被代理到 abc.test.com
如果标头值为 brand-id: pqr 那么请求应该被代理到 pqr.test.com
我在“端点 URL”值中期待这样的东西: http://${stageVariables.${method.request.header.brand-id}}/
任何帮助实现这一点将不胜感激。
解决方案
AFAIK this is not possible on the API Gateway level. Option is to do the mapping on the lambda integration level.
推荐阅读
- objective-c - 将 NULL id 传递给从 Obj-C 到 Swift 的回调时的 EXC_BAD_ACCESS
- variables - 反应式编程是否会回到通过引用传递?
- ffmpeg - 如何在 h.264 视频中寻找特定帧?
- scala - 在 Scala Spark 中的转换之间持久化数据是否有帮助?
- python-3.x - Tensorflow 无法创建 cudnn 句柄:CUDNN_STATUS_ALLOC_FAILED
- python - 错误 Flask 命令“点击”未定义
- java - 如何在 android web 应用程序中启用放大和缩小?
- for-loop - 计算每个部分的数字实例的 AWK 脚本
- javascript - 将 Javascript 对象转换为代理(而不是其引用)
- php - 查找 MySQL 数据库的网址