Skip to content

Commit

Permalink
implement elastic#16714 (ability to set CORS origins)
Browse files Browse the repository at this point in the history
  • Loading branch information
Elad Katz committed Jul 28, 2019
1 parent f5ad6ad commit d38f100
Showing 1 changed file with 24 additions and 5 deletions.
29 changes: 24 additions & 5 deletions src/core/server/http/http_config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,36 @@ export const config = {
cors: schema.conditional(
schema.contextRef('dev'),
true,
schema.object(
{
origin: schema.arrayOf(schema.string()),
},
schema.oneOf(
[
schema.object({
origin: schema.arrayOf(schema.string()),
additionalHeaders: schema.arrayOf(schema.string()),
credentials: schema.boolean(),
}),
schema.boolean(),
],
{
defaultValue: {
origin: ['*://localhost:9876'], // karma test server
additionalHeaders: [],
credentials: false,
},
}
),
schema.boolean({ defaultValue: false })
schema.oneOf(
[
schema.object({
origin: schema.arrayOf(schema.string()),
additionalHeaders: schema.arrayOf(schema.string()),
credentials: schema.boolean(),
}),
schema.boolean(),
],
{
defaultValue: false,
}
)
),
host: schema.string({
defaultValue: 'localhost',
Expand Down

0 comments on commit d38f100

Please sign in to comment.