Open styliii opened 1 year ago
@styliii I don't think this is related to Rack::CORS. Take a look at this:
I'm guessing you're not running behind nginx, but something is not lining up in either how you're testing, or in your app setup.
Thanks for taking a look. I'm able to isolate it to a couple of line changes in my application.rb
file. When I uncomment those last 3 lines, it stops working.
module MyPlatform
class Application < Rails::Application
config.load_defaults 7.0
config.autoload_paths += %W(#{config.root}/lib)
config.api_only = true
# config.session_store :cookie_store, key: '_wf_session'
# config.middleware.use ActionDispatch::Cookies
# config.middleware.use config.session_store, config.session_options
end
end
For some reason, when I add cookie related middleware (specifically
ActionDispatch::Session::Cookie
), therack-cors
gem stops working. I'll get theActionController::InvalidAuthenticityToken (HTTP Origin header (http://localhost:3000) didn't match request.base_url (http://localhost:3001)):
error. Once I remove the cookie related middleware, everything starts working again. Any ideas? I've tried movingActionDispatch::Cookies
andActionDispatch::Session::CookieStore
aboveRack::Cors
, but that didn't work either.Here's my
bundle exec rake middleware
output:My request