Created
February 13, 2013 09:25
-
-
Save olistik/4943295 to your computer and use it in GitHub Desktop.
Handle CORS with Rails
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# application_controller.rb | |
before_filter :handle_cors | |
def handle_cors | |
if env.keys.include? "HTTP_ORIGIN" | |
response.headers['Access-Control-Allow-Origin'] = 'http://www.myapp.com' | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment