【发布时间】:2019-05-08 17:34:24
【问题描述】:
请帮帮我。我做错了什么。我想通过 api gataway 访问 ec2 并写了一个 cloudformation 模板
paths:
/{proxy+}:
x-amazon-apigateway-any-method:
headers:
Access-Control-Allow-Headers:
type: "string"
Access-Control-Allow-Methods:
type: "string"
Access-Control-Allow-Origin:
type: "string"
Content-Type:
type: "string"
authority:
type: "string"
produces:
- "application/json"
parameters:
- name: "proxy"
in: "path"
required: false
type: "string"
responses: {}
x-amazon-apigateway-integration:
responses:
default:
statusCode: "200"
uri: "http://ec2-1111111111.eu-west-1.compute.amazonaws.com/{proxy}"
requestParameters:
integration.request.header.Content-Type: "'text/html'"
"integration.request.path.proxy": "method.request.path.proxy"
passthroughBehavior: "when_no_match"
httpMethod: ANY
type: "http_proxy
为此,我定义了 1 个端点 http_proxy。当我测试这个端点时,一切正常,但是一旦我部署 api 并尝试通过浏览器访问,错误 404 就会崩溃
【问题讨论】:
-
您是否检查过 CloudWatch 中的 API 网关日志?
-
移除并重新部署堆栈后,我实现了页面显示,但外部css工作不正确
标签: amazon-ec2 amazon-cloudformation aws-api-gateway