Skip to content

Commit

Permalink
Merge pull request #44 from delta10/fix/42-options-response-filter-proxy
Browse files Browse the repository at this point in the history
Allow private network CORS setting
  • Loading branch information
bartjkdp authored Mar 11, 2024
2 parents 85e714e + 3f6c532 commit fc1522f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
9 changes: 5 additions & 4 deletions cmd/filter-proxy/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -312,10 +312,11 @@ func main() {
var httpHandler http.Handler
if len(config.Cors.AllowedOrigins) > 0 {
c := cors.New(cors.Options{
AllowedOrigins: config.Cors.AllowedOrigins,
AllowedMethods: config.Cors.AllowedMethods,
AllowedHeaders: config.Cors.AllowedHeaders,
AllowCredentials: config.Cors.AllowCredentials,
AllowedOrigins: config.Cors.AllowedOrigins,
AllowedMethods: config.Cors.AllowedMethods,
AllowedHeaders: config.Cors.AllowedHeaders,
AllowCredentials: config.Cors.AllowCredentials,
AllowPrivateNetwork: config.Cors.AllowPrivateNetwork,
})

httpHandler = c.Handler(router)
Expand Down
9 changes: 5 additions & 4 deletions internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,11 @@ type Path struct {
}

type Cors struct {
AllowedOrigins []string `yaml:"allowedOrigins"`
AllowedMethods []string `yaml:"allowedMethods"`
AllowedHeaders []string `yaml:"allowedHeaders"`
AllowCredentials bool `yaml:"allowCredentials"`
AllowedOrigins []string `yaml:"allowedOrigins"`
AllowedMethods []string `yaml:"allowedMethods"`
AllowedHeaders []string `yaml:"allowedHeaders"`
AllowCredentials bool `yaml:"allowCredentials"`
AllowPrivateNetwork bool `yaml:"allowPrivateNetwork"`
}

type Config struct {
Expand Down

0 comments on commit fc1522f

Please sign in to comment.