Giter Site home page Giter Site logo

Comments (6)

dfguo avatar dfguo commented on July 23, 2024

I am wondering the same question. I have been testing it, and it doesn't seem to allow it.

from rack-cors.

AEtherSurfer avatar AEtherSurfer commented on July 23, 2024

You may need to set :credentials to false, if you are using a cdn and the cache populating request does not include the Origin header then the cdn will not have the cors headers. This may be a bug in rack-cors where public_resources that do not require credentials should send the cors headers even if no Origin is in the request.
(FYI Chrome does not seem to send the Origin header)

from rack-cors.

dfguo avatar dfguo commented on July 23, 2024

I see. Thanks for the message. I have found another gem that allows sending headers on different resources. https://github.com/thomasklemm/butler

from rack-cors.

cyu avatar cyu commented on July 23, 2024

It looks like all you have to do is make sure Rack::Cors middleware is defined before ActionDispatch::Static:

# config/application.rb

config.middleware.insert_before "ActionDispatch::Static", "Rack::Cors" do
  allow do
    origins '*'
    resource '*',
      :headers => :any,
      :methods => [:get, :post, :delete, :put, :options],
      :max_age => 0
  end
end

from rack-cors.

kenips avatar kenips commented on July 23, 2024

I'm getting the same problem with Rails 4. I wonder if this is still applicable? Not seeing any headers being set at the moment.

from rack-cors.

cyu avatar cyu commented on July 23, 2024

What kind of stack are you running (unicorn, passenger, etc)? Also, what is the output of rake middleware and your Cors configuration?

from rack-cors.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.