awslabs / multi-model-server

Multi Model Server is a tool for serving neural net models for inference
Apache License 2.0
998 stars 230 forks source link

How to enable CORS on mms #768

Closed MaxTran96 closed 5 years ago

MaxTran96 commented 5 years ago
Screen Shot 2019-03-11 at 8 37 11 AM Screen Shot 2019-03-11 at 8 10 29 AM Screen Shot 2019-03-08 at 4 54 20 AM

I'm not sure how to enable CORS on this. Thanks!

MaxTran96 commented 5 years ago

I have the header request in my code as well a config.properties file that contains those lines of code in the documentation. I still have the error

MaxTran96 commented 5 years ago
Screen Shot 2019-03-11 at 8 43 19 AM

my config.properties file

ddavydenko commented 5 years ago

Hey @MaxTran96 , have you tried to use * for the cors_allowed_origin value?

frankfliu commented 5 years ago

@MaxTran96

You should not added header "Access-Control-Allow-Origin: *" to your request, browser should append "Origin: http://localhost:3001" to the header. can you capture the request header sent by browser to check if the request was sent properly?

Remember, CORS is doing string match, suggest use "*" for testing.

ddavydenko commented 5 years ago

In conversation over slack channel we were able to clarify with @MaxTran96 that he was using axios to send requests. Once he switched to fetch API this issue was resolved for him. I am going to close this issue, @MaxTran96 please feel free to add more details if necessary.