2
我在Heroku上一個Rails應用程序使用此配置:Rails應用程序 - 問題與CORS
module MyAppApi
class Application < Rails::Application
# other configs
config.middleware.use Rack::Cors do
allow do
origins '*'
resource '*',
:headers => :any,
:methods => [:get, :post, :delete, :put, :options]
end
end
end
end
我的問題是,任何要求用301個狀態返回。例如:
$ curl \
-i -H 'Accept: application/json' \
-H 'Content-Type: application/json' \
-X OPTIONS 'http://myappapi.heroku.com/api/v1/resource.json'
HTTP/1.1 301 Moved Permanently
Server: nginx
Date: Fri, 17 May 2013 14:56:00 GMT
Content-Length: 0
Connection: keep-alive
Location: http://myappapi.heroku.com/api/v1/resource.json
GET,POST的相同響應。任何有關這裏發生的事情的想法?提前致謝。
是什麼'routes.rb'樣子? – CuriousMind