# HTTP Proxy via CloudFormation

**URL:** <https://forum.serverless.com/t/http-proxy-via-cloudformation/1366>\
**Category:** Serverless Framework\
**Tags:** aws\
**Created:** [February 21, 2017, 11:15am UTC](https://forum.serverless.com/t/http-proxy-via-cloudformation/1366 "2017-02-21T11:15:53Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![timwis](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/timwis/32/443_2.png) [@timwis](https://forum.serverless.com/u/timwis)\
**Post date:** [February 28, 2017, 12:48pm UTC](https://forum.serverless.com/t/http-proxy-via-cloudformation/1366/3 "2017-02-28T12:48:33Z")

</div>

Update: I got it working! I noticed that the exported swagger is _basically_ cloudformation, so that told me what pieces were missing from the original cloudformation.

```auto
resources:
  Resources:
    ProxyParentResource:
      Type: AWS::ApiGateway::Resource
      Properties:
        ParentId:
          Fn::GetAtt:
            - ApiGatewayRestApi # serverless default Rest API logical ID
            - RootResourceId
        PathPart: 'carto'
        RestApiId:
          Ref: ApiGatewayRestApi
    ProxyResource:
      Type: AWS::ApiGateway::Resource
      Properties:
        ParentId:
          Ref: ProxyParentResource
        PathPart: '{proxy+}' # the endpoint in your API that is set as proxy
        RestApiId:
          Ref: ApiGatewayRestApi
    ProxyMethod:
      Type: AWS::ApiGateway::Method
      Properties:
        ResourceId:
          Ref: ProxyResource
        RestApiId:
          Ref: ApiGatewayRestApi
        AuthorizationType: NONE
        HttpMethod: GET # the method of your proxy. Is it GET or POST or ... ?
        MethodResponses:
          - StatusCode: 200
        RequestParameters:
          method.request.path.proxy: true
        Integration:
          IntegrationHttpMethod: GET
          Type: HTTP_PROXY
          Uri: https://phl.carto.com/{proxy} # the URL you want to set a proxy to
          IntegrationResponses:
            - StatusCode: 200
          RequestParameters:
            integration.request.path.proxy: method.request.path.proxy
            integration.request.header.Accept-Encoding: "'identity'"
          PassthroughBehavior: WHEN_NO_MATCH

```

---

_[View the full topic](https://forum.serverless.com/t/http-proxy-via-cloudformation/1366)._
