【发布时间】:2015-12-04 17:22:55
【问题描述】:
我正在尝试使用 AWS API 网关创建 API
- 首先我创建了一个资源作为 /sample
- 然后创建了一个方法 GET
- 提供 Endpoint-URL 并保存。
- 在“方法执行”窗格中,选择“方法请求”,将 HTTP 请求标头添加为“授权”,添加此以将基本身份验证详细信息传递到后端 url,因为服务受到基本身份验证的保护,
- 在“方法执行”窗格中,选择集成请求、映射的 HTTP 标头、映射自“method.request.path.Authorization”
- 选择Method Execution,在Client框中选择TEST,通过Header Authorization - Basic XXXXXX 成功完成所有配置后,测试API,得到“message”:“Internal server error”状态码-500
供您参考,我的后端服务在 amazon-linux 机器上运行。
Checked logs:
Execution log for request test-request
Tue Sep 08 16:43:54 UTC 2015 : Starting execution for request: test-invoke-request
Tue Sep 08 16:43:54 UTC 2015 : API Key: test-invoke-api-key
Tue Sep 08 16:43:54 UTC 2015 : Method request path: {}
Tue Sep 08 16:43:54 UTC 2015 : Method request query string: {}
Tue Sep 08 16:43:54 UTC 2015 : Method request headers: {Authorization=************p1c2Vy}
Tue Sep 08 16:43:54 UTC 2015 : Method request body before transformations: null
Tue Sep 08 16:43:54 UTC 2015 : Execution failed due to configuration error: Invalid endpoint address
您能告诉我如何解决这个问题吗?
【问题讨论】:
-
你说你的后端在amazon-linux机器上运行,这台机器有与之关联的公共IP吗?它在 ELB 后面吗?
标签: aws-api-gateway