This is a repost form this Github issue : https://github.com/rails/rails/issues/11380
I would like to have your opinion about the following : When sending an AJAX request, one expect `request.xhr?` to return `true`, but this is not true when using jQuery and CORS. This problem is caused by the fact jQuery decided to not automatically send `X_HTTP_REQUESTED_WITH` header for CORS requests (see. http://bugs.jquery.com/ticket/8423). I think every CORS requests should be considered as XHR requests. And I would advocate updating `action_dispatch/http/request.rb` `ActionDispatch::Request#xhr?` to return true for every CORS requests. This might be implemented by detecting presence of `Origin` header (and maybe checking `Host` and `https`). Do you see any use-case where CORS requests would not be XHR requests or any other issue with this proposal ? Thanks ! -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/rubyonrails-core. For more options, visit https://groups.google.com/groups/opt_out.
