Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve CORS default configuration #202

Closed
blackjid opened this issue Jun 1, 2019 · 2 comments · Fixed by #271
Closed

Improve CORS default configuration #202

blackjid opened this issue Jun 1, 2019 · 2 comments · Fixed by #271
Assignees
Labels

Comments

@blackjid
Copy link
Member

blackjid commented Jun 1, 2019

No description provided.

@rjherrera
Copy link
Member

rjherrera commented Feb 16, 2020

We should definitely address this ASAP. I'd like to suggest something like this:

config.middleware.insert_before 0, Rack::Cors do
  allow do
    origins '*'
    resource '/public/*', headers: :any, methods: :get
    resource '/api/*',
      headers: :any,
      expose: ['X-Page', 'X-PageTotal'],
      methods: :any
  end
end

Maybe with an explicit or more restrictive list of allowed methods for the api routes, like [:get, :post, :put, :options], but the main idea is there.

What do you think @blackjid ?

@blackjid
Copy link
Member Author

great, yes.. we should...
looks good... maybe we can bring in someone else to review in a PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging a pull request may close this issue.

2 participants