Enable CORS for API Gateway in Cloudformation template

后端 未结 5 1976
礼貌的吻别
礼貌的吻别 2020-12-08 10:36

I\'m creating AWS Cloudformation template for my environment and I can\'t find a way to enable CORS for API Gateway method.

I can configure it using AWS console (her

5条回答
  •  庸人自扰
    2020-12-08 11:05

    The API Gateway support for automatic CORS configuration currently only works via the API Gateway console. You can still set-up CORS yourself when importing an API from swagger or when defining an API via CloudFormation, but you must specify all the parameters for setting up the OPTIONS method as well as adding the CORS specific headers to your other methods.

    This page shows how to set-up CORS when importing swagger. Setting up CORS via CloudFormation is conceptually similar, but uses the CloudFormation syntax rather than the swagger syntax.

提交回复
热议问题