fixed Access-Control-Allow-Origin issue

I was having issues with javascript not getting responses from the server with this error "Origin http://127.0.0.1:5001 is not allowed by Access-Control-Allow-Origin." Adding this function fixed it for me.