spacy-api-docker
spacy-api-docker copied to clipboard
Request from another container
I‘m getting an error (Cross origin) when I am doing a request from another container. How can I enable cors?
Hmm, interestingly I haven't run into that problem myself so far. How exactly are you making your request?
A fix could be adding this middleware https://github.com/falconry/falcon/issues/1220#issuecomment-363266844 to the Python code here https://github.com/jgontrum/spacy-api-docker/blob/a33fd3c6c58d4883f071d681484b03ede9557eb6/displacy_service/server.py#L151 I don't know how soon I have time to integrate it, so feel free to make a PR :)
Hi, so I was on the right path. exactly there I wanted to add the cross_origin but I was not sure, if the mistake is not my request itself. I tried to make an ajax request.
first of all i created the container a bit different, because I want to make the request from another docker container, so i created the container like
docker run -it -p "0.0.0.0:8080:80" jgontrum/spacyapi:en_v2
I have a nodejs container, where my application is hosted on. the request is done from a javascript
$.ajax({
type: "PUT",
url: "http://
I think the request should be right. and the error which is given is:
Access to XMLHttpRequest at 'http://<my_ip>:8080/ent' from origin 'http://<my_ip>:<nodejs_port>' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.
Thanks for your help