我的网站在做第三方登录功能,需要有 post 方式跨站请求,但是提示我这个错我
No 'Access-Control-Allow-Origin' header is present on the requested resource
貌似需要设置这个,怎么设置呢,有人说用 jsonp 方式提交,但是 jquery 和 js 都不支持 post 方式的请求
#congfig.ru
require 'rack/cors'
use Rack::Cors do
allow do
origins '*'
resource '*',
headers: :any,
methods: [:get, :post, :put, :delete, :options]
end
end
after_action:access_control_headersdefaccess_control_headersheaders['Access-Control-Allow-Origin']="*"# or your web site like http://localhost:4200headers['Access-Control-Request-Method']=%w{GET POST OPTIONS}.join(",")end