Created
March 7, 2015 13:01
-
-
Save raphaklaus/645d298d79d5c96824af to your computer and use it in GitHub Desktop.
Ruby on Rails CORS
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
class ApplicationController < ActionController::API | |
after_filter :cors | |
def cors | |
headers['Access-Control-Allow-Origin'] = '*' | |
headers['Access-Control-Allow-Methods'] = 'OPTIONS, POST, DELETE, GET, PUT' | |
headers['Access-Control-Allow-Headers'] = 'Origin, X-Requested-With, Content-Type, Accept' | |
headers['Access-Control-Max-Age'] = '1728000' | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment