Open wesleysmith12 opened 6 years ago
I'm having a similar error, for this minimal Rack app:
app = Rack::Builder.new do
use Rack::Cors do
allow do
origins '*'
resource '*', headers: :any, methods: [:put, :get, :post, :delete, :options]
end
end
run lambda { |env|
['200', {'Content-Type' => 'text/html'}, ['response accepted']]
}
end
Rack::Handler::WEBrick.run app, {Port: 3000}
I strongly suspect that my problem was caused by bailing out without returning anything, further down in the stack (there's an if
inside that lambda that I edited out for clarity.) I made sure to return something for all cases, and I haven't seen the problem since.
@wesleysmith12 - I reckon the gem could handle this case more gracefully, but maybe this will help setup a work around for you?
I'm doing some issue gardening 🌱🌿 🌷 and came upon this issue. Since it's quite old I just wanted to ask if this is still relevant? If it isn't, maybe we can close this issue?
By closing some old issues we reduce the list of open issues to a more manageable set.
Gemfil:
Output (not error happens only after request)
Because I was curious, I looked at the file /home/ubuntu/.rvm/gems/ruby-2.4.1@MYAPP/gems/rack-cors-1.0.2/lib/rack/cors.rb:114:in `call':
Line 114 is:
vary = headers[VARY]
Not sure why that wouldn't be set, but I'm getting an error cause of it.