Skip to content

Commit 18a43f0

Browse files
authored
docs: Update README.md to better explain the default for the origin parameter (#91)
1 parent c33bd69 commit 18a43f0

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

README.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ $ npm install @koa/cors --save
2424

2525
Enable cors with default options:
2626

27-
- origin: request Origin header
27+
- origin: `*` (v4 and before: the request's Origin header). This means that **by default the requests from all origin webpages will be allowed**.
28+
If you're running a generic API server, this is what you want, but otherwise you should look into changing the default to something more
29+
suitable to your application.
2830
- allowMethods: GET,HEAD,PUT,POST,DELETE,PATCH
2931

3032
```js
@@ -57,7 +59,7 @@ app.use(cors());
5759
*/
5860
```
5961

60-
## Breaking change between 5.0 and 4.0
62+
## Breaking change between 4.0 and 5.0
6163

6264
The default `origin` is set to `*`, if you want to keep the 4.0 behavior, you can set the `origin` handler like this:
6365

0 commit comments

Comments
 (0)