Created

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist

Handle CORS with Rails

View gist:4943295
1 2 3 4 5 6 7 8
# 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
Something went wrong with that request. Please try again.