Skip to content

Commit 5ea8281

Browse files
authored
[7.x] Add server.publicBaseUrl config (#85075) (#85361)
1 parent 0c9a3c0 commit 5ea8281

37 files changed

+260
-45
lines changed

config/kibana.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@
1818
# default to `true` starting in Kibana 7.0.
1919
#server.rewriteBasePath: false
2020

21+
# Specifies the public URL at which Kibana is available for end users. If
22+
# `server.basePath` is configured this URL should end with the same basePath.
23+
#server.publicBaseUrl: ""
24+
2125
# The maximum payload size in bytes for incoming server requests.
2226
#server.maxPayloadBytes: 1048576
2327

docs/development/core/public/kibana-plugin-core-public.ibasepath.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ export interface IBasePath
1818
| --- | --- | --- |
1919
| [get](./kibana-plugin-core-public.ibasepath.get.md) | <code>() =&gt; string</code> | Gets the <code>basePath</code> string. |
2020
| [prepend](./kibana-plugin-core-public.ibasepath.prepend.md) | <code>(url: string) =&gt; string</code> | Prepends <code>path</code> with the basePath. |
21+
| [publicBaseUrl](./kibana-plugin-core-public.ibasepath.publicbaseurl.md) | <code>string</code> | The server's publicly exposed base URL, if configured. Includes protocol, host, port (optional) and the [IBasePath.serverBasePath](./kibana-plugin-core-public.ibasepath.serverbasepath.md)<!-- -->. |
2122
| [remove](./kibana-plugin-core-public.ibasepath.remove.md) | <code>(url: string) =&gt; string</code> | Removes the prepended basePath from the <code>path</code>. |
2223
| [serverBasePath](./kibana-plugin-core-public.ibasepath.serverbasepath.md) | <code>string</code> | Returns the server's root basePath as configured, without any namespace prefix.<!-- -->See for getting the basePath value for a specific request |
2324

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
2+
3+
[Home](./index.md) &gt; [kibana-plugin-core-public](./kibana-plugin-core-public.md) &gt; [IBasePath](./kibana-plugin-core-public.ibasepath.md) &gt; [publicBaseUrl](./kibana-plugin-core-public.ibasepath.publicbaseurl.md)
4+
5+
## IBasePath.publicBaseUrl property
6+
7+
The server's publicly exposed base URL, if configured. Includes protocol, host, port (optional) and the [IBasePath.serverBasePath](./kibana-plugin-core-public.ibasepath.serverbasepath.md)<!-- -->.
8+
9+
<b>Signature:</b>
10+
11+
```typescript
12+
readonly publicBaseUrl?: string;
13+
```
14+
15+
## Remarks
16+
17+
Should be used for generating external URL links back to this Kibana instance.
18+

docs/development/core/server/kibana-plugin-core-server.basepath.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ The constructor for this class is marked as internal. Third-party code should no
2222
| --- | --- | --- | --- |
2323
| [get](./kibana-plugin-core-server.basepath.get.md) | | <code>(request: KibanaRequest &#124; LegacyRequest) =&gt; string</code> | returns <code>basePath</code> value, specific for an incoming request. |
2424
| [prepend](./kibana-plugin-core-server.basepath.prepend.md) | | <code>(path: string) =&gt; string</code> | Prepends <code>path</code> with the basePath. |
25+
| [publicBaseUrl](./kibana-plugin-core-server.basepath.publicbaseurl.md) | | <code>string</code> | The server's publicly exposed base URL, if configured. Includes protocol, host, port (optional) and the [BasePath.serverBasePath](./kibana-plugin-core-server.basepath.serverbasepath.md)<!-- -->. |
2526
| [remove](./kibana-plugin-core-server.basepath.remove.md) | | <code>(path: string) =&gt; string</code> | Removes the prepended basePath from the <code>path</code>. |
2627
| [serverBasePath](./kibana-plugin-core-server.basepath.serverbasepath.md) | | <code>string</code> | returns the server's basePath<!-- -->See [BasePath.get](./kibana-plugin-core-server.basepath.get.md) for getting the basePath value for a specific request |
2728
| [set](./kibana-plugin-core-server.basepath.set.md) | | <code>(request: KibanaRequest &#124; LegacyRequest, requestSpecificBasePath: string) =&gt; void</code> | sets <code>basePath</code> value, specific for an incoming request. |
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
2+
3+
[Home](./index.md) &gt; [kibana-plugin-core-server](./kibana-plugin-core-server.md) &gt; [BasePath](./kibana-plugin-core-server.basepath.md) &gt; [publicBaseUrl](./kibana-plugin-core-server.basepath.publicbaseurl.md)
4+
5+
## BasePath.publicBaseUrl property
6+
7+
The server's publicly exposed base URL, if configured. Includes protocol, host, port (optional) and the [BasePath.serverBasePath](./kibana-plugin-core-server.basepath.serverbasepath.md)<!-- -->.
8+
9+
<b>Signature:</b>
10+
11+
```typescript
12+
readonly publicBaseUrl?: string;
13+
```
14+
15+
## Remarks
16+
17+
Should be used for generating external URL links back to this Kibana instance.
18+

docs/development/core/server/kibana-plugin-core-server.httpserverinfo.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
## HttpServerInfo interface
66

7+
Information about what hostname, port, and protocol the server process is running on. Note that this may not match the URL that end-users access Kibana at. For the public URL, see [BasePath.publicBaseUrl](./kibana-plugin-core-server.basepath.publicbaseurl.md)<!-- -->.
78

89
<b>Signature:</b>
910

docs/development/core/server/kibana-plugin-core-server.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ The plugin integrates with the core system via lifecycle events: `setup`<!-- -->
8686
| [HttpResourcesRenderOptions](./kibana-plugin-core-server.httpresourcesrenderoptions.md) | Allows to configure HTTP response parameters |
8787
| [HttpResourcesServiceToolkit](./kibana-plugin-core-server.httpresourcesservicetoolkit.md) | Extended set of [KibanaResponseFactory](./kibana-plugin-core-server.kibanaresponsefactory.md) helpers used to respond with HTML or JS resource. |
8888
| [HttpResponseOptions](./kibana-plugin-core-server.httpresponseoptions.md) | HTTP response parameters |
89-
| [HttpServerInfo](./kibana-plugin-core-server.httpserverinfo.md) | |
89+
| [HttpServerInfo](./kibana-plugin-core-server.httpserverinfo.md) | Information about what hostname, port, and protocol the server process is running on. Note that this may not match the URL that end-users access Kibana at. For the public URL, see [BasePath.publicBaseUrl](./kibana-plugin-core-server.basepath.publicbaseurl.md)<!-- -->. |
9090
| [HttpServiceSetup](./kibana-plugin-core-server.httpservicesetup.md) | Kibana HTTP Service provides own abstraction for work with HTTP stack. Plugins don't have direct access to <code>hapi</code> server and its primitives anymore. Moreover, plugins shouldn't rely on the fact that HTTP Service uses one or another library under the hood. This gives the platform flexibility to upgrade or changing our internal HTTP stack without breaking plugins. If the HTTP Service lacks functionality you need, we are happy to discuss and support your needs. |
9191
| [HttpServiceStart](./kibana-plugin-core-server.httpservicestart.md) | |
9292
| [I18nServiceSetup](./kibana-plugin-core-server.i18nservicesetup.md) | |

docs/setup/settings.asciidoc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -442,6 +442,11 @@ running behind a proxy. Use the <<server-rewriteBasePath, `server.rewriteBasePat
442442
if it should remove the basePath from requests it receives, and to prevent a
443443
deprecation warning at startup. This setting cannot end in a slash (`/`).
444444

445+
|[[server-publicBaseUrl]] `server.publicBaseUrl:`
446+
| The publicly available URL that end-users access Kibana at. Must include the protocol, hostname, port
447+
(if different than the defaults for `http` and `https`, 80 and 443 respectively), and the
448+
<<server-basePath, `server.basePath`>> (if configured). This setting cannot end in a slash (`/`).
449+
445450
| [[server-compression]] `server.compression.enabled:`
446451
| Set to `false` to disable HTTP compression for all responses. *Default: `true`*
447452

packages/kbn-config/src/legacy/__snapshots__/legacy_object_to_config_adapter.test.ts.snap

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/kbn-config/src/legacy/legacy_object_to_config_adapter.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ describe('#get', () => {
9090
keepaliveTimeout: 5000,
9191
socketTimeout: 2000,
9292
port: 1234,
93+
publicBaseUrl: 'https://myhost.com/abc',
9394
rewriteBasePath: false,
9495
ssl: { enabled: true, keyPassphrase: 'some-phrase', someNewValue: 'new' },
9596
compression: { enabled: true },
@@ -113,6 +114,7 @@ describe('#get', () => {
113114
keepaliveTimeout: 5000,
114115
socketTimeout: 2000,
115116
port: 1234,
117+
publicBaseUrl: 'http://myhost.com/abc',
116118
rewriteBasePath: false,
117119
ssl: { enabled: false, certificate: 'cert', key: 'key' },
118120
compression: { enabled: true },

0 commit comments

Comments
 (0)