You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
1.1 KiB

  1. # Be sure to restart your server when you modify this file.
  2. # Avoid CORS issues when API is called from the frontend app.
  3. # Handle Cross-Origin Resource Sharing (CORS) in order to accept cross-origin AJAX requests.
  4. # Read more: https://github.com/cyu/rack-cors
  5. Rails.application.config.middleware.insert_before 0, Rack::Cors do
  6. allow do
  7. origins '*'
  8. resource '/@:username',
  9. headers: :any,
  10. methods: [:get],
  11. credentials: false
  12. resource '/api/*',
  13. headers: :any,
  14. methods: [:post, :put, :delete, :get, :patch, :options],
  15. credentials: false,
  16. expose: ['Link', 'X-RateLimit-Reset', 'X-RateLimit-Limit', 'X-RateLimit-Remaining', 'X-Request-Id']
  17. resource '/oauth/token',
  18. headers: :any,
  19. methods: [:post],
  20. credentials: false
  21. resource '/assets/*', headers: :any, methods: [:get, :head, :options]
  22. resource '/stylesheets/*', headers: :any, methods: [:get, :head, :options]
  23. resource '/javascripts/*', headers: :any, methods: [:get, :head, :options]
  24. resource '/packs/*', headers: :any, methods: [:get, :head, :options]
  25. end
  26. end