1
랙 - 코어 젬을 사용하여 레일 애플리케이션에 CORS를 구현하고 있지만 다른 기원에 대해 어떻게 다른 리소스를 정의 할 수 있는지 잘 모르겠습니다.ruby on rails - diffrenet 리소스가있는 여러 랙 기둥을 가진 랙 - 랙
config.middleware.insert_before 0, Rack::Cors do
allow do
origins 'http://localhost:3000'
resource '/api/*', headers: :any, methods: [:get, :post, :options, :put, :delete]
end
allow do
origins 'http://localhost:6000'
resource '*', headers: :any, methods: [:get, :post, :options, :put, :delete]
end
end
는 그래서 "http://localhost:3000을"수 '/ API는/*' 허용 'http://localhost:6000'모든에만 액세스 할 수 액세스 할 수 :
나는 그런 일을해야합니다. 그것은 가능한가?
은 위의 코드에서 올바른 코드/구문을 사용하고 있습니까?
감사합니다.
'origins'에서'http : // '를 제거해보십시오. – 31piy