You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I tested running a request on the toponym resolution tool using JavaScript's fetch function, and ran into two (possibly combined) issues: the API server does not currently have a CORS (Access-Control-Allow-Origin) header on the resource, and requests might be blocked because they are not served over HTTPS.
Possible solution to CORS problem
FastAPI offers a CORS middleware, CORSMiddleware which can easily be added to the app:
I think, for the origins list, we might want to let the value be ['*'] as we'd like to allow requests from anywhere (?). This is open for discussion, obviously.
I tested running a request on the toponym resolution tool using JavaScript's
fetch
function, and ran into two (possibly combined) issues: the API server does not currently have a CORS (Access-Control-Allow-Origin) header on the resource, and requests might be blocked because they are not served over HTTPS.Possible solution to CORS problem
FastAPI offers a CORS middleware,
CORSMiddleware
which can easily be added to the app:I think, for the
origins
list, we might want to let the value be['*']
as we'd like to allow requests from anywhere (?). This is open for discussion, obviously.Possible solution to HTTPS problem
The line that needs editing is:
https://github.com/Living-with-machines/toponym-resolution/blob/751b8a191f66fe4e7e9d55dc9b0a74812c019eb0/app/app_template.py#L70
This StackOverflow shows the change to the
uvicorn.run
command needed:The StackOverflow uses a tool, mkcert, to create certificate files. I am sure there are other ways, but this seems fairly straightforward.
The text was updated successfully, but these errors were encountered: