2
votes

AWS API gateway HTTP proxy integration returns the following error when I tried to proxy to another URL.

Thu Jul 04 13:34:51 UTC 2019 : Sending request to https://api.example.com/{proxy}
Thu Jul 04 13:34:51 UTC 2019 : Execution failed due to configuration error: Illegal character in path at index 38: https://api.example.com/{proxy}
Thu Jul 04 13:34:51 UTC 2019 : Method completed with status: 500

The issue is with {proxy}. If that's removed, my API works perfectly. From AWS documentation, they have it the same as well, so i wasn't expecting any issue.

Has anyone met this issue before and how did you resolve it or is there anything else I need set or maybe set wrongly? Thanks.

2

2 Answers

1
votes

Managed to resolve it after more debugging.

I was using Terraform to configure API gateway and i missed out to add request_parameters in both aws_api_gateway_method and aws_api_gateway_integration resources.

0
votes

If this configuration is being imported from an open api 3 schema using terraform, then this is how it would look like:

/v2/{proxy+}:
    x-amazon-apigateway-any-method:
      parameters:
        - name: "proxy"
          in: "path"
          required: true
          type: "string"
      x-amazon-apigateway-integration:
        uri: "https://api.example.com/{proxy}"
        responses:
          default:
            statusCode: "401"
        requestParameters:
          integration.request.path.proxy: "method.request.path.proxy"
        connectionType: "INTERNET"
        httpMethod: "ANY"
        type: "http_proxy"