我正在使用 C9 AWS 实例来运行用 ruby on rails 编写的 API REST,并且我正在通过简单的 http 调用从 Ionic 应用程序中消耗资源。当我从 ionic 应用程序发出 http 请求时,服务器会响应以下消息:
如何在 Cloud 9 实例中启用 CORS?
Failed to load https://the_server.vfs.cloud9.us-east-2.amazonaws.com/resource: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8100' is therefore not allowed access. The response had HTTP status code 404.
我已经使用rack-cors gem在 rails 中启用了 CORS