https://github.com/krakend/krakend-cors
Adds CORS support to the KrakenD framework
https://github.com/krakend/krakend-cors
api-gateway cors gin krakend krakend-cors mux
Last synced: 8 months ago
JSON representation
Adds CORS support to the KrakenD framework
- Host: GitHub
- URL: https://github.com/krakend/krakend-cors
- Owner: krakend
- License: apache-2.0
- Created: 2018-06-05T20:35:06.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2025-01-17T14:38:09.000Z (9 months ago)
- Last Synced: 2025-02-01T02:33:46.435Z (9 months ago)
- Topics: api-gateway, cors, gin, krakend, krakend-cors, mux
- Language: Go
- Homepage: https://krakend.io
- Size: 93.8 KB
- Stars: 10
- Watchers: 7
- Forks: 10
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://goreportcard.com/report/github.com/krakendio/krakend-cors) [](https://godoc.org/github.com/krakendio/krakend-cors)
KrakenD CORS
====A set of building blocks for instrumenting [KrakenD](http://www.krakend.io) gateways
## Available flavours
1. [mux](github.com/krakendio/krakend-cors/blob/master/mux) Mux based handlers
2. [gin](github.com/krakendio/krakend-cors/blob/master/gin) Gin based handlersCheck the tests and the documentation for more details
## Configuration
You need to add an ExtraConfig section to the configuration to enable the CORS middleware.
At least one option should be defined.- `allow_origins` list of strings (you can also use a wildcard, leaving it empty allows all origins too)
- `allow_headers` list of strings
- `allow_methods` list of strings
- `expose_headers` list of strings
- `allow_credentials` bool
- `max_age` duration (Ex: "12h", "5m", "3600s", ...)### Configuration Example
```
"extra_config": {
"github_com/devopsfaith/krakend-cors": {
"allow_origins": [ "http://foobar.com" ],
"allow_methods": [ "POST", "GET"],
"max_age": "12h"
}
}
```or leave the defaults (the defaults allows all origins):
```
"extra_config": {
"github_com/devopsfaith/krakend-cors": {
"allow_origins": []
}
}
```