Skip to content

Instantly share code, notes, and snippets.

@jamiew
Created June 18, 2012 22:49
Show Gist options
  • Save jamiew/2951250 to your computer and use it in GitHub Desktop.
Save jamiew/2951250 to your computer and use it in GitHub Desktop.
class ApplicationController
after_filter :set_access_control_headers
def set_access_control_headers
# Any domain
# headers['Access-Control-Allow-Origin'] = '*'
# Specific domain
allowed_domain = "http://" + request.domain
headers['Access-Control-Allow-Origin'] = allowed_domain
headers['Access-Control-Allow-Credentials'] = 'true'
# headers['Access-Control-Allow-Methods'] = 'POST, GET, OPTIONS'
# headers['Access-Control-Request-Method'] = '*'
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment