-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add ability to specify CORS accepted origins #84316
Changes from 10 commits
cc0487a
8de37ff
fa1c924
29bfcae
e96ecea
f2ebd59
e17fbdf
eaf7782
f1659ec
0d7590c
fc7415b
03903c5
e11ef00
d5c8507
466bd8b
569baf4
8f57ec8
bcebb53
e9aa9ff
9884a2c
3b8a509
8d6ea81
d0956f8
3e19081
30b45aa
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -445,6 +445,15 @@ deprecation warning at startup. This setting cannot end in a slash (`/`). | |
| [[server-compression]] `server.compression.enabled:` | ||
| Set to `false` to disable HTTP compression for all responses. *Default: `true`* | ||
|
||
| `server.cors.enabled:` | ||
| experimental[] Set to `true` to allow cross-origin API calls. *Default:* `false` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we're marking the old There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. FWIW, the old There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. that's correct. from #16714 (comment)
We can mark it as GA, but it means that we won't be able to introduce any breaking changes if needed. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Gotcha - I don't have any objections to marking as experimental or beta then |
||
|
||
| `server.cors.credentials:` | ||
| experimental[] Set to `true` to allow browser code to access response body whenever request performed with user credentials. *Default:* `false` | ||
|
||
| `server.cors.origin:` | ||
| experimental[] List of origins permitted to access resources. You must specify `server.cors.origin` when `server.cors.credentials: true`. *Default:* "*" | ||
mshustov marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
| `server.compression.referrerWhitelist:` | ||
| Specifies an array of trusted hostnames, such as the {kib} host, or a reverse | ||
proxy sitting in front of it. This determines whether HTTP compression may be used for responses, based on the request `Referer` header. | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import Url from 'url'; | ||
import Path from 'path'; | ||
import getPort from 'get-port'; | ||
import type { FtrConfigProviderContext } from '@kbn/test/types/ftr'; | ||
import { kbnTestConfig } from '@kbn/test'; | ||
import { pageObjects } from '../functional/page_objects'; | ||
|
||
export default async function ({ readConfigFile }: FtrConfigProviderContext) { | ||
const kibanaFunctionalConfig = await readConfigFile(require.resolve('../functional/config.js')); | ||
|
||
const corsTestPlugin = Path.resolve(__dirname, './plugins/kibana_cors_test'); | ||
|
||
const servers = { | ||
...kibanaFunctionalConfig.get('servers'), | ||
elasticsearch: { | ||
...kibanaFunctionalConfig.get('servers.elasticsearch'), | ||
}, | ||
kibana: { | ||
...kibanaFunctionalConfig.get('servers.kibana'), | ||
}, | ||
}; | ||
|
||
const { protocol, hostname } = kbnTestConfig.getUrlParts(); | ||
const pluginPort = await getPort({ port: 9000 }); | ||
const originUrl = Url.format({ | ||
protocol, | ||
hostname, | ||
port: pluginPort, | ||
}); | ||
|
||
return { | ||
testFiles: [require.resolve('./tests')], | ||
servers, | ||
services: kibanaFunctionalConfig.get('services'), | ||
pageObjects, | ||
junit: { | ||
reportName: 'Kibana CORS with X-Pack Security', | ||
}, | ||
|
||
esTestCluster: kibanaFunctionalConfig.get('esTestCluster'), | ||
apps: { | ||
...kibanaFunctionalConfig.get('apps'), | ||
}, | ||
|
||
kbnTestServer: { | ||
...kibanaFunctionalConfig.get('kbnTestServer'), | ||
serverArgs: [ | ||
...kibanaFunctionalConfig.get('kbnTestServer.serverArgs'), | ||
`--plugin-path=${corsTestPlugin}`, | ||
`--test.cors.port=${pluginPort}`, | ||
'--server.cors.enabled=true', | ||
'--server.cors.credentials=true', | ||
`--server.cors.origin=["${originUrl}"]`, | ||
], | ||
}, | ||
}; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import { GenericFtrProviderContext } from '@kbn/test/types/ftr'; | ||
import { pageObjects } from '../functional/page_objects'; | ||
import { services } from './services'; | ||
|
||
export type FtrProviderContext = GenericFtrProviderContext<typeof services, typeof pageObjects>; | ||
export { pageObjects }; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"id": "kibana_cors_test", | ||
"version": "1.0.0", | ||
"kibanaVersion": "kibana", | ||
"configPath": ["test", "cors"], | ||
"server": true, | ||
"ui": false | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kobelb We should start with marking it as
experimental
, I supposeThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we're marking the old
server.cors
setting as deprecated, then I'm not sure we should replace it with an experimental setting. Is there a reason to believe this won't be stable enough to mark as GA?