Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
Added a quick note about how DefaultConfig does not allow all origins by default. I ran into this error previously and it seems to confuse a lot of other people too
  • Loading branch information
nlatham1999 committed Oct 11, 2021
1 parent aa5c43d commit 028d2d3
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Expand Up @@ -69,11 +69,13 @@ func main() {
config := cors.DefaultConfig()
config.AllowOrigins = []string{"http://google.com"}
// config.AllowOrigins == []string{"http://google.com", "http://facebook.com"}
// config.AllowAllOrigins = true

router.Use(cors.New(config))
router.Run()
}
```
note: while Default() allows all origins, DefaultConfig() does not and you will still have to use AllowAllOrigins

### Default() allows all origins

Expand Down

0 comments on commit 028d2d3

Please sign in to comment.