From 47af8a87d9ea896cbf6f13a803f1d29c0ef9ab57 Mon Sep 17 00:00:00 2001 From: Calvin Yu Date: Fri, 18 Dec 2020 20:53:38 -0500 Subject: [PATCH] Updates to note common issues. --- README.md | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 395a686..68e3b83 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ Read more about it here in the [Rails Guides](https://guides.rubyonrails.org/con ### Rack Configuration -NOTE: If you're running Rails, updating in `config/application.rb` should be enough. There is no need to update `config.ru` as well. +NOTE: If you're running Rails, adding `config/initializers/cors.rb` should be enough. There is no need to update `config.ru` as well. In `config.ru`, configure `Rack::Cors` by passing a block to the `use` command: @@ -109,6 +109,15 @@ A Resource path can be specified as exact string match (`/path/to/file.txt`) or ## Common Gotchas +### Origin Matching + +When specifying an origin, make sure that it does not have a trailing slash. + +### Testing Postman and/or CURL + +* Make sure you're passing in an `Origin:` header. That header is required to trigger a CORS response. +* Make sure your origin does not have a trailing slash. + ### Positioning in the Middleware Stack Positioning of `Rack::Cors` in the middleware stack is very important. In the Rails example above we put it above all other middleware which, in our experience, provides the most consistent results.