Last active
September 29, 2015 20:44
-
-
Save brunnogomes/c0ae7eb19b55a5b46867 to your computer and use it in GitHub Desktop.
Simple CORS in Rails (just for development please)
This file contains 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
# other stuff... | |
after_action :set_cors_headers # use after_filter if Rails < 4 | |
def set_cors_headers | |
headers['Access-Control-Allow-Origin'] = "*" | |
headers['Access-Control-Request-Method'] = %w{GET POST OPTIONS}.join(",") | |
end | |
# other stuff... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment