Skip to content
This repository has been archived by the owner on Jul 16, 2021. It is now read-only.

Commit

Permalink
fix CORS for deployments (#302)
Browse files Browse the repository at this point in the history
  • Loading branch information
prydonius authored Jun 29, 2017
1 parent 573ad36 commit 8364dab
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
6 changes: 4 additions & 2 deletions deployment/monocular/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,11 @@ api:
# source: my-repository-source
cors:
allowed_origins:
- my-api-server
- ""
# e.g. UI served on a different domain
# - http://monocular.local
allowed_headers:
- "access-control-allow-headers"
- "content-type"
- "x-xsrf-token"
# Enable Helm deployment integration
releasesEnabled: true
Expand Down
4 changes: 2 additions & 2 deletions docs/config.example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ repos:

# cors:
# allowed_origins:
# - my-api-server
# - my-ui-hostname
# allowed_headers:
# - "access-control-allow-headers"
# - "content-type"
# - "x-xsrf-token"

# Enables Helm deployment integration
Expand Down
4 changes: 2 additions & 2 deletions src/api/config/cors/cors.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ func defaultCors() (Cors, error) {
}
// Defaults
return Cors{
AllowedOrigins: []string{"my-api-server"},
AllowedHeaders: []string{"access-control-allow-headers", "x-xsrf-token"},
AllowedOrigins: []string{""},
AllowedHeaders: []string{"content-type", "x-xsrf-token"},
}, nil
}

Expand Down
4 changes: 2 additions & 2 deletions src/api/config/cors/cors_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ var configFileOk = filepath.Join("..", "testdata", "config.yaml")
var configFileNotOk = filepath.Join("..", "testdata", "bogus_config.yaml")
var configFileNoCors = filepath.Join("..", "testdata", "nocors_config.yaml")
var defaultExpectedCors = Cors{
AllowedOrigins: []string{"my-api-server"},
AllowedHeaders: []string{"access-control-allow-headers", "x-xsrf-token"},
AllowedOrigins: []string{""},
AllowedHeaders: []string{"content-type", "x-xsrf-token"},
}

func TestConfigFileDoesNotExist(t *testing.T) {
Expand Down

0 comments on commit 8364dab

Please sign in to comment.