码迷,mamicode.com
首页 > Windows程序 > 详细

使用 API Gateway 导入 API 对资源启用 CORS

时间:2019-10-03 23:43:43      阅读:140      评论:0      收藏:0      [点我收藏+]

标签:methods   header   correct   app   cat   access   导入   temp   control   

/users 
   options:
      summary: CORS support
      description: |
        Enable CORS by returning correct headers
      consumes:
        - application/json
      produces:
        - application/json
      tags:
        - CORS
      x-amazon-apigateway-integration:
        type: mock
        requestTemplates:
          application/json: |
            {
              "statusCode" : 200
            }
        responses:
          "default":
            statusCode: "200"
            responseParameters:
              method.response.header.Access-Control-Allow-Headers : "‘Content-Type,X-Amz-Date,Authorization,X-Api-Key‘"
              method.response.header.Access-Control-Allow-Methods : "‘*‘"
              method.response.header.Access-Control-Allow-Origin : "‘*‘"
            responseTemplates:
              application/json: |
                {}
      responses:
        200:
          description: Default response for CORS method
          headers:
            Access-Control-Allow-Headers:
              type: "string"
            Access-Control-Allow-Methods:
              type: "string"
            Access-Control-Allow-Origin:
              type: "string"
      responses:
        200:
          description: Default response for CORS method
          headers:
            Access-Control-Allow-Headers:
              type: "string"
            Access-Control-Allow-Methods:
              type: "string"
            Access-Control-Allow-Origin:
              type: "string"

 

使用 API Gateway 导入 API 对资源启用 CORS

标签:methods   header   correct   app   cat   access   导入   temp   control   

原文地址:https://www.cnblogs.com/cloudrivers/p/11620923.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!