Created
August 26, 2015 00:14
-
-
Save dpaluy/d76d52d59ac3619fcc97 to your computer and use it in GitHub Desktop.
Solving CORS with rack-cors gem
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
| class Application < Rails::Application | |
| # ... | |
| config.middleware.insert_before Warden::Manager, Rack::Cors do | |
| allow do | |
| origins %r{^https?:\/\/[a-z0-9\-]+.yourdomain.com:?\d*$}i | |
| resource '*', | |
| headers: :any, | |
| methods: [:get, :post, :put, :create, :delete, :options] | |
| end | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment