AWS API Gateway Greedy HTTP Proxy

Hi there!

In the AWS API Gateway you can define a greedy HTTP-Proxy. However, for the life of me I can’t sort out how to define it in my serverless.yml.

I can easily create it in the API Gateway UI, but I can’t replicate it in serverless. If i go ahead and do it manually in the UI, my deploys get rejected.

In the serverless yaml representation that should be something like

Resources:
    ProxyResource:
      Type: AWS::ApiGateway::Resource
      Properties:
        ParentId:
          Fn::GetAtt:
            - ApiGatewayRestApi # our default Rest API logical ID
            - RootResourceId
        PathPart: some.other.cdn # the endpoint in your API that is set as proxy
        RestApiId:
          Ref: ApiGatewayRestApi
    Proxy:
      Type: AWS::ApiGateway::Method
      Properties:
       AuthorizationType: NONE
        ResourceId:
          Ref: ProxyResource
        RestApiId:
          Ref: ApiGatewayRestApi
        RequestParameters:
          method.request.path.proxy: true
        HttpMethod: ANY # the method of your proxy. Is it GET or POST or ... ?
        MethodResponses:
          - StatusCode: 200
        Integration:
          # ConnectionType: INTERNET
          IntegrationHttpMethod: ANY
          Type: HTTP_PROXY
          Uri: https://some.other.cdn/{proxy} # the URL you want to set a proxy to
          IntegrationResponses:
            - StatusCode: 200
          PassthroughBehavior: WHEN_NO_MATCH
          RequestParameters:
            integration.request.path.proxy: method.request.path.proxy

Did you ever solve this. I am hitting the same issue