From larry.martell at gmail.com Mon Nov 9 17:38:20 2020 From: larry.martell at gmail.com (Larry Martell) Date: Mon, 9 Nov 2020 17:38:20 -0500 Subject: [Flask] CORS issue Message-ID: I have a flask app that is deployed on many AWS hosts. All of them work, except for 1, which gets this error: Access to XMLHttpRequest at 'https://apidse-foo.com/group/1011/arrays' from origin 'https://dse-foo.com' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. All are running Amazon Linux AMI 2018.03 and all are running the same flask code and JS code. What could be different on this 1 system from the others that is causing this? How can I debug this? I added this: logging.getLogger('flask_cors').level = logging.DEBUG But I did not get any debugging logging. From yahir.amat at gmail.com Mon Nov 9 17:40:53 2020 From: yahir.amat at gmail.com (Yahir Amat) Date: Mon, 9 Nov 2020 17:40:53 -0500 Subject: [Flask] CORS issue In-Reply-To: References: Message-ID: There is a nice flask Cors plug-in that will allow you to set remote origins to a specific address or a remote host. Or you can set anything you want. On Mon, Nov 9, 2020 at 5:39 PM Larry Martell wrote: > I have a flask app that is deployed on many AWS hosts. All of them > work, except for 1, which gets this error: > > Access to XMLHttpRequest at 'https://apidse-foo.com/group/1011/arrays' > from origin 'https://dse-foo.com' has been blocked by CORS policy: No > 'Access-Control-Allow-Origin' header is present on the requested > resource. > > All are running Amazon Linux AMI 2018.03 and all are running the same > flask code and JS code. What could be different on this 1 system from > the others that is causing this? How can I debug this? I added this: > > logging.getLogger('flask_cors').level = logging.DEBUG > > But I did not get any debugging logging. > _______________________________________________ > Flask mailing list > Flask at python.org > https://mail.python.org/mailman/listinfo/flask > -------------- next part -------------- An HTML attachment was scrubbed... URL: From larry.martell at gmail.com Mon Nov 9 17:42:37 2020 From: larry.martell at gmail.com (Larry Martell) Date: Mon, 9 Nov 2020 17:42:37 -0500 Subject: [Flask] CORS issue In-Reply-To: References: Message-ID: Yes, I should have said, I am already using that. from flask_cors import CORS cors = CORS(application) On Mon, Nov 9, 2020 at 5:41 PM Yahir Amat wrote: > > There is a nice flask Cors plug-in that will allow you to set remote origins to a specific address or a remote host. Or you can set anything you want. > > On Mon, Nov 9, 2020 at 5:39 PM Larry Martell wrote: >> >> I have a flask app that is deployed on many AWS hosts. All of them >> work, except for 1, which gets this error: >> >> Access to XMLHttpRequest at 'https://apidse-foo.com/group/1011/arrays' >> from origin 'https://dse-foo.com' has been blocked by CORS policy: No >> 'Access-Control-Allow-Origin' header is present on the requested >> resource. >> >> All are running Amazon Linux AMI 2018.03 and all are running the same >> flask code and JS code. What could be different on this 1 system from >> the others that is causing this? How can I debug this? I added this: >> >> logging.getLogger('flask_cors').level = logging.DEBUG >> >> But I did not get any debugging logging. >> _______________________________________________ >> Flask mailing list >> Flask at python.org >> https://mail.python.org/mailman/listinfo/flask From mennoholscher at gmail.com Wed Nov 11 07:08:47 2020 From: mennoholscher at gmail.com (Menno Holscher) Date: Wed, 11 Nov 2020 13:08:47 +0100 Subject: [Flask] CORS issue In-Reply-To: References: Message-ID: Op 09-11-2020 om 23:38 schreef Larry Martell: > I have a flask app that is deployed on many AWS hosts. All of them > work, except for 1, which gets this error: > > Access to XMLHttpRequest at 'https://apidse-foo.com/group/1011/arrays' > from origin 'https://dse-foo.com' has been blocked by CORS policy: No > 'Access-Control-Allow-Origin' header is present on the requested > resource. Isn't it just that apidse-foo.com is not a subdomain of dse-foo.com? I would expect api.dse-foo.com. Menno H?lscher From larry.martell at gmail.com Wed Nov 11 09:34:04 2020 From: larry.martell at gmail.com (Larry Martell) Date: Wed, 11 Nov 2020 09:34:04 -0500 Subject: [Flask] CORS issue In-Reply-To: References: Message-ID: On Wed, Nov 11, 2020 at 9:30 AM Menno Holscher wrote: > > Op 09-11-2020 om 23:38 schreef Larry Martell: > > I have a flask app that is deployed on many AWS hosts. All of them > > work, except for 1, which gets this error: > > > > Access to XMLHttpRequest at 'https://apidse-foo.com/group/1011/arrays' > > from origin 'https://dse-foo.com' has been blocked by CORS policy: No > > 'Access-Control-Allow-Origin' header is present on the requested > > resource. > > Isn't it just that apidse-foo.com is not a subdomain of dse-foo.com? I > would expect api.dse-foo.com. The issue was resolved -the CORS message was a red herring. The problem was with the auto-scaling group registering the instance.Thanks to all who replied.