0
我想限制設計到一個API的JSON請求與這從互聯網。它有什麼作用?這個設計配置是做什麼的?
# config/initializers/devise.rb
config.http_authenticatable_on_xhr = false
config.navigational_formats = ["*/", :html, :json]
我想限制設計到一個API的JSON請求與這從互聯網。它有什麼作用?這個設計配置是做什麼的?
# config/initializers/devise.rb
config.http_authenticatable_on_xhr = false
config.navigational_formats = ["*/", :html, :json]
從色器件文檔,
config.http_authenticatable_on_xhr =真
If http headers should be returned for AJAX requests. True by default.
config.navigational_formats = [" / ",:HTML,:JSON]
==> Navigation configuration
Lists the formats that should be treated as navigational. Formats like
:html, should redirect to the sign in page when the user does not have
access, but formats like :xml or :json, should return 401.
If you have any extra navigational formats, like :iphone or :mobile, you
should add them to the navigational formats lists.
The :"*/*" and "*/*" formats below is required to match Internet
Explorer requests.