I fixed the problem by changing the cors method with the one shown below which I found online. It would be nice if someone can explain what sort of majic is going on here .i.e.: what is a pahe handler in this case or whatever.
Handle both simple and complex CORS requests
Add CORS headers to each response. If the request is a CORS preflight
request swap out the default handler with a simple, single-purpose handler
that verifies the request and provides a valid CORS response.
req_head = cherrypy.request.headers
resp_head = cherrypy.response.headers
# Always set response headers necessary for 'simple' CORS.