Set up CORS hander for error responses

/to @ritch 

See https://github.com/strongloop/loopback/issues/575
I wrapped the cors middleware to check if the origin matches the request url.