Closed xaxis-ii closed 2 years ago
CORS preflight requests to /groups, /datasets or /datatypes fail when sent from browser or curl (using for example
/groups
/datasets
/datatypes
curl -H "Origin: http://example.com" -H "Access-Control-Request-Method: POST" -H "Access-Control-Request-Headers: authorization" -X OPTIONS --verbose http://localhost:5101/groups
This seems to be an issue with the aiohttp_cors library, and overriding the default accepted methods (by changing line 106 of hsds/servicenode.py to
aiohttp_cors
hsds/servicenode.py
cors = aiohttp_cors.setup(app, defaults={cors_domain: aiohttp_cors.ResourceOptions(allow_credentials=True, expose_headers="*", allow_headers="*", allow_methods=["POST", "PUT", "GET", "DELETE"])})
seems to fix it. I suspected the route /groups might be clashing with /groups/, but disabling the latter didn't help.
/groups/
Running on Debian 10, POSIX-based storage, via docker (with 6 service nodes and 2 data nodes).
Makes sense, thanks for the proposed fix !
CORS preflight requests to
/groups
,/datasets
or/datatypes
fail when sent from browser or curl (using for exampleThis seems to be an issue with the
aiohttp_cors
library, and overriding the default accepted methods (by changing line 106 ofhsds/servicenode.py
toseems to fix it. I suspected the route
/groups
might be clashing with/groups/
, but disabling the latter didn't help.Running on Debian 10, POSIX-based storage, via docker (with 6 service nodes and 2 data nodes).