【发布时间】:2017-12-19 17:10:51
【问题描述】:
我正在使用 C9 AWS 实例来运行用 ruby on rails 编写的 API REST,并且我正在通过简单的 http 调用来使用 Ionic 应用程序中的资源。
当我从 ionic 应用程序发出 http 请求时,服务器会响应以下消息:
Failed to load @987654321@: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin '@987654322@' is therefore not allowed access. The response had HTTP status code 404.
如何在 Cloud 9 实例中启用 CORS?
我已经使用 rack-cors gem
在 Rails 中启用了 CORS【问题讨论】:
-
AFAIK,似乎有一个选项可以将实例设置为公共而不是私有......如果你将它设置为公共,它应该给你 cors 访问权限
-
你知道怎么改吗?
标签: ruby-on-rails amazon-web-services c9.io rack-cors