chalice icon indicating copy to clipboard operation
chalice copied to clipboard

CORS flag doesn't update on redeployment

Open anovis opened this issue 7 years ago • 5 comments

After the initial creation of an endpoint, changing the CORS flag doesn't seem to update the endpoint. i had to manually go into api gateway to fix the cors to what i needed .

anovis avatar Dec 12 '18 19:12 anovis

+1 On chalice 1.60 and 1.6.1

lstroud avatar Dec 20 '18 16:12 lstroud

Is this when you update via the API or a packaged cloudformation template? Or both?

stealthycoin avatar Dec 22 '18 00:12 stealthycoin

It happened via the API while running chalice deploy command after changing the CORS field in one of my routes. 

anovis avatar Dec 22 '18 05:12 anovis

I was not able to reproduce. Here is what I tried...

Original chalice app

I started with this chalice app:

from chalice import Chalice
from chalice import CORSConfig

app = Chalice(app_name='issue1018')


@app.route('/cors', methods=['GET'])
def supports_custom_cors():
    return {'cors': True}

I then made the following request (Note there are no CORS headers):

$ http https://hq7r2nxmc7.execute-api.us-west-2.amazonaws.com/api/cors
HTTP/1.1 200 OK
Connection: keep-alive
Content-Length: 13
Content-Type: application/json
Date: Wed, 09 Jan 2019 00:48:44 GMT
Via: 1.1 9b311162717b41c968f6f00426d88aaa.cloudfront.net (CloudFront)
X-Amz-Cf-Id: Var0Ge_wDKHXkGZs-i2omJvF8C5ofdr0WjrEWtZbhD2TppboWcr2wQ==
X-Amzn-Trace-Id: Root=1-5c3544eb-9f2abf3a7c6d4d62be191d02;Sampled=0
X-Cache: Miss from cloudfront
x-amz-apigw-id: TNe03FBGPHcFcPQ=
x-amzn-RequestId: 509cafbf-13a8-11e9-a2a5-89da9e4c2c8f

{
    "cors": true
}

Updated chalice app

I then updated the app for cors:

from chalice import Chalice
from chalice import CORSConfig

app = Chalice(app_name='issue1018')


@app.route('/cors', methods=['GET'], cors=True)
def supports_custom_cors():
    return {'cors': True}

Then I made a request and it had the CORS headers coming back

$ http https://hq7r2nxmc7.execute-api.us-west-2.amazonaws.com/api/cors
HTTP/1.1 200 OK
Access-Control-Allow-Headers: Authorization,Content-Type,X-Amz-Date,X-Amz-Security-Token,X-Api-Key
Access-Control-Allow-Origin: *
Connection: keep-alive
Content-Length: 13
Content-Type: application/json
Date: Wed, 09 Jan 2019 00:50:39 GMT
Via: 1.1 7f5e0d3b9ea85d0d75063a66c0ebc841.cloudfront.net (CloudFront)
X-Amz-Cf-Id: _bp1_FlpoXTYQU4ined6kMegCqU54BwwoTf3ih-ejGEcgXAeJ8bhag==
X-Amzn-Trace-Id: Root=1-5c35455f-82d290e20a5de36e3701f005;Sampled=0
X-Cache: Miss from cloudfront
x-amz-apigw-id: TNfG5HK-vHcFmoA=
x-amzn-RequestId: 956b208a-13a8-11e9-b62f-4fa37ecf21eb

{
    "cors": true
}

Could you provide a sample app/steps to help us reproduce this?

kyleknap avatar Jan 09 '19 00:01 kyleknap

This issue has been automatically closed because there has been no response to our request for more information from the original author. With only the information that is currently in the issue, we don't have enough information to take action. Please reach out if you have or find the answers we need so that we can investigate further.

no-response[bot] avatar Jan 16 '19 01:01 no-response[bot]