首页 文章
  • 0 votes
     answers
     views

    Rails API rack-cors不会阻止起源

    我使用gem rack-cors在我的Rails 5 API中配置Cors,并将以下代码添加到我的application.rb: config.middleware.insert_before 0, Rack::Cors, :debug => true, :logger => (-> {Rails.logger }) do allow do origi...
  • 1 votes
     answers
     views

    Sinatra Rack路由

    我有一个看起来像这个ws_app.rb的app文件: require 'rubygems' require 'sinatra' require 'sinatra/respond_to' require 'dm-core' require 'dm-migrations' require 'dm-timestamps' require 'json' require 'csv' load 'model...
  • 5 votes
     answers
     views

    Rack-Cors并发送500或403错误的标头

    我开始使用rack-cors进行必要的跨站点javascript / api实现 . 当它正常工作时,一切正常,但如果前端的某些内容在后端触发500错误,则客户端永远不会收到正确的标头 . 您只是在客户端开发工具上看到这个: No 'Access-Control-Allow-Origin' header is present on the requested resource. 这是CORS的工...
  • 2 votes
     answers
     views

    在机架应用程序中使用CORS和Warden(Grape API)

    我有一个基于Grape的API作为机架应用程序运行,使用rack-cors来允许跨源请求,使用Warden进行身份验证 . CORS按预期工作,但不是在我调用 env['warden'].authenticate 的情况下 . 在这些情况下,我收到"origin not allowed"回复 . 我相信这是由于中间件的顺序,但我对机架应用程序相对较新 . I found s...

热门问题