- Neueste
- Die meisten Stimmen
- Die meisten Kommentare
Hi There
Looking at your documentation provided, it says:
When you enable CORS and authorization for the $default route, there are some special considerations. The $default route catches requests for all methods and routes that you haven't explicitly defined, including OPTIONS requests. Now, the CLI example provided is the basic for enabling CORS on the $default route, which takes care of all the other routes.
Looking at the documentation for the APIv2 CLI, you can use the --route-selection-expression
parameter.
The route selection expression for the API. For HTTP APIs, the routeSelectionExpression must be ${request.method} ${request.path}. If not provided, this will be the default for HTTP APIs. This property is required for WebSocket APIs.
So if you would like to add CORS to a specific route, your CLI would look something like this:
aws apigatewayv2 update-api --api-id api-id --route-selection-expression ${request.method} ${request.path} --cors-configuration AllowOrigins="https://www.example.com"
Hope that helps.
Relevanter Inhalt
- AWS OFFICIALAktualisiert vor 2 Jahren
- AWS OFFICIALAktualisiert vor einem Jahr
- AWS OFFICIALAktualisiert vor 2 Jahren
- AWS OFFICIALAktualisiert vor einem Jahr
Thanks for taking the time to answer this. I'll make this the accepted answer as it's easy to test the two versions of
aws apigatewayv2 update-api
on an existing API.