Skip to content

Instantly share code, notes, and snippets.

@brunnogomes
Last active September 29, 2015 20:44
Show Gist options
  • Save brunnogomes/c0ae7eb19b55a5b46867 to your computer and use it in GitHub Desktop.
Save brunnogomes/c0ae7eb19b55a5b46867 to your computer and use it in GitHub Desktop.
Simple CORS in Rails (just for development please)
# 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