Skip to content
This repository was archived by the owner on Jan 28, 2025. It is now read-only.
This repository was archived by the owner on Jan 28, 2025. It is now read-only.

entire backend API Proxy feature #258

Closed
@TylerShin

Description

@TylerShin

When using serverless-next-js with Serverless Component, there isn't input for api gateway setting.

For example, when using the legacy serverless.yml, we can override current default api gateway like below example.

resources:
  Resources:    
    APIProxyResourceParent:
      Type: AWS::ApiGateway::Resource
      Properties:
        ParentId:
          Fn::GetAtt:
            - ApiGatewayRestApi
            - RootResourceId
        PathPart: api
        RestApiId:
          Ref: ApiGatewayRestApi
    APIProxyResource:
      Type: AWS::ApiGateway::Resource
      Properties:
        ParentId:
          Ref: APIProxyResourceParent
        PathPart: '{proxy+}'
        RestApiId:
          Ref: ApiGatewayRestApi
    APIProxyMethod:
      Type: AWS::ApiGateway::Method
      Properties:
        ResourceId:
          Ref: APIProxyResource
        RestApiId:
          Ref: ApiGatewayRestApi
        HttpMethod: ANY
        AuthorizationType: NONE
        RequestParameters:
         method.request.path.proxy: true
        Integration:
          IntegrationHttpMethod: any
          Type: HTTP_PROXY
          Uri: ${file(./env/${opt:stage}.yml):API_ENDPOINT}
          RequestParameters:
           integration.request.path.proxy: method.request.path.proxy
          IntegrationResponses:
            - StatusCode: 200

I know that I can handle each endpoint of API gateway inside of NextJS from v9. however, making all of the API endpoint seems to redundant and annoying.

Also NextJS official document saying we should implement these proxy behavior by making custom server(sth like express or custom routing for Now)

However, we couldn't use custom server with serverless-next.js.
So I think this feature should be handled by serverless-next.js.

is there any solution for the proxy feature?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions