webmachine/webmachine-ruby

CORS support

kgish opened this issue · 3 comments

I want to add CORS support to my server by adding the following header to its response:

Access-Control-Allow-Origin: *

What's the best way to do this?

create a finish_request callback for a resource and set the headers there: https://github.com/seancribbs/webmachine-ruby/blob/master/lib/webmachine/resource/callbacks.rb#L363

response.headers['Access-Control-Allow-Origin'] = '*'

Thought we should start a wiki page for all these little "how do I do ... with webmachine?" questions. https://github.com/seancribbs/webmachine-ruby/wiki/How-do-I-do-...-with-Webmachine%3F

Great idea, I'll see if I can add some creative ideas there.