Skip to content

Instantly share code, notes, and snippets.

@kurko
Created July 21, 2014 16:23
Show Gist options
  • Save kurko/724c2a435ec0840e2872 to your computer and use it in GitHub Desktop.
Save kurko/724c2a435ec0840e2872 to your computer and use it in GitHub Desktop.
class ApplicationController < ActionController::Base
# Prevent CSRF attacks by raising an exception.
# For APIs, you may want to use :null_session instead.
#protect_from_forgery with: :exception
before_action :set_headers
def set_headers
headers["Endpoint-Purpose"] = "point_of_sale"
if Rails.env.development?
headers['Access-Control-Allow-Origin'] = '*'
headers['Access-Control-Allow-Methods'] = 'POST, PUT, DELETE, GET, OPTIONS'
headers['Access-Control-Request-Method'] = '*'
headers['Access-Control-Allow-Headers'] = 'Origin, X-Requested-With, Content-Type, Accept, Authorization'
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment