Last active
July 19, 2017 14:02
-
-
Save alex-hall/3114a9b7a005905338064e8a01c0b01c to your computer and use it in GitHub Desktop.
Configure Sinatra for CORS (Whitelist from any domain, don't actually do this in production)
This file contains hidden or 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
require 'sinatra' | |
set :server, 'webrick' | |
before do | |
response.headers['Access-Control-Allow-Origin'] = '*' | |
end | |
options '*' do | |
response.headers['Access-Control-Allow-Methods'] = 'GET, POST, PUT, PATCH, DELETE, OPTIONS' | |
response.headers['Access-Control-Allow-Headers'] = 'content-type,x-csrf-token,x-requested-with' | |
200 | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment