nytud / emtsv

e-magyar text processing system -- inter-module communication via tsv + REST API
GNU Lesser General Public License v3.0
27 stars 11 forks source link

REST API CORS support #17

Open softwaretailoring opened 3 years ago

softwaretailoring commented 3 years ago

I built my own Docker image as suggested in #14. Now I can use the REST API without the Internal Server Error. However, there is a CORS issue.

When I tried an API call via Ajax request I got the following error:

Access to XMLHttpRequest at 'http://localhost:5000/tok/morph/pos/conv-morph/dep' from origin 'https://localhost:44399' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

I can solve it with a new Docker build with modified uwsgi.ini. I've added this line:

add-header = Access-Control-Allow-Origin: https://localhost:44399

Do you want to provide CORS support? Maybe in a configurable manner?