I'm using an AWS CloudFormation template (or OpenAPI API definition) to create an Amazon API Gateway API with a proxy resource. When I create the API, I get the following error: "Execution failed due to configuration error: Illegal character in path."
Short description
If a URL path parameter mapping for the proxy path parameter ({proxy+}) isn't defined, then API Gateway returns the following error: "Execution failed due to configuration error: Illegal character in path.:
Without a URL path parameter mapping defined for this parameter in the integration request, API Gateway evaluates the parameter as the literal string "{proxy+}". Because "{" isn't a valid character, API Gateway returns an error when this happens.
To resolve the error, define the URL path parameter mapping for the proxy path parameter in the integration request by doing the following:
Resolution
- In the API Gateway console, choose the name of your API.
- With the method selected in the Resources pane, choose Integration Request in the Method Execution pane.
- In the Integration Request pane, verify that the Endpoint URL uses the correct proxy path parameter: {proxy}. (The greedy path variable without "+".) For example: http://example.com/{proxy}
- Expand URL Path Parameters. Then, choose Add path and do the following:
For Name, enter proxy. This corresponds to the parameter in the Endpoint URL.
For Mapped from, enter method.request.path.proxy.
Note: Here, proxy corresponds to the name of the request path as defined in the Method Request pane. This request path is added by creating a proxy resource named {proxy} or, for a greedy path variable, {proxy+}.
- Choose the check mark icon (Create).
Note: If you get an Invalid mapping expression specified error, update your AWS CloudFormation template or OpenAPI definition. Then, repeat the previous steps.
- Deploy your API.
Related information
Set up a proxy integration with a proxy resource
Set up request and response data mappings using the API Gateway console
Set up an API integration request using the API Gateway console