端点api网关测试正常通过,但是在部署时出现错误404

时间:2018-12-06 23:35:19

标签: amazon-ec2 amazon-cloudformation aws-api-gateway

请帮帮我。我做错了什么。我想通过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就会崩溃

1 个答案:

答案 0 :(得分:0)

在移除并重新部署堆栈之后,我实现了页面显示,但是仍然无法确保已连接的CSS文件正确连接。

enter image description here