hi
im reading through the topic above and trying to apply it to my app.
as reference i found:http://leopard.in.ua/2012/07/08/using-cors-with-rails/

my prob is that i dont see the 'preflight', meaning the first request
prior the actual post, which should(?) deliver this:
request.request_method=='OPTIONS'

the js code look like this:
$.ajax
({
type: 'POST',
dataType: "json",
crossDomain: true,
url: "http://someserver/foo.json",
data: {test:999},

in application_controller.rb i have this in a before filter:
def cors
p "calling - CORS"
p request.request_method #<< this is "POST" instead of the expected OPTIONS
p request.headers["HTTP_ORIGIN"] #<< this is http://localhost
from which im posting
head(:ok) if true # request.request_method == "OPTIONS"
end
also in the browser inspection i see only the actual post, not the
preflight request sending the OPTIONS.

am i on a wrong track here?

thx

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Search Discussions

  • Tom at Dec 1, 2012 at 12:17 am
    never mind, client caching

    On Fri, Nov 30, 2012 at 11:32 PM, tom wrote:
    hi
    im reading through the topic above and trying to apply it to my app.
    as reference i found:http://leopard.in.ua/2012/07/08/using-cors-with-rails/

    my prob is that i dont see the 'preflight', meaning the first request
    prior the actual post, which should(?) deliver this:
    request.request_method=='OPTIONS'

    the js code look like this:
    $.ajax
    ({
    type: 'POST',
    dataType: "json",
    crossDomain: true,
    url: "http://someserver/foo.json",
    data: {test:999},

    in application_controller.rb i have this in a before filter:
    def cors
    p "calling - CORS"
    p request.request_method #<< this is "POST" instead of the expected OPTIONS
    p request.headers["HTTP_ORIGIN"] #<< this is http://localhost
    from which im posting
    head(:ok) if true # request.request_method == "OPTIONS"
    end
    also in the browser inspection i see only the actual post, not the
    preflight request sending the OPTIONS.

    am i on a wrong track here?

    thx
    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouprubyonrails-talk @
categoriesrubyonrails
postedNov 30, '12 at 10:32p
activeDec 1, '12 at 12:17a
posts2
users1
websiterubyonrails.org
irc#RubyOnRails

1 user in discussion

Tom: 2 posts

People

Translate

site design / logo © 2021 Grokbase