Skip to content

Commit 97fc31f

Browse files
committed
First iteration of PoC working
1 parent 64ce959 commit 97fc31f

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

src/legacy/core_plugins/console/index.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import { first } from 'rxjs/operators';
2222
import { resolve, join, sep } from 'path';
2323
import url from 'url';
2424
import { has, isEmpty, head, pick } from 'lodash';
25+
import { LiveHostsManager } from './server/live_hosts_manager';
2526

2627
// @ts-ignore
2728
import { addProcessorDefinition } from './server/api_server/es_6_0/ingest';
@@ -142,7 +143,8 @@ export default function(kibana: any) {
142143

143144
server.route(
144145
createProxyRoute({
145-
baseUrl: head(legacyEsConfig.hosts),
146+
// baseUrl: head(legacyEsConfig.hosts),
147+
liveHostsManager: new LiveHostsManager(legacyEsConfig.hosts),
146148
pathFilters: proxyPathFilters,
147149
getConfigForReq(req: any, uri: any) {
148150
const filteredHeaders = filterHeaders(

src/legacy/core_plugins/console/server/proxy_route.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ function getProxyHeaders(req) {
5858
}
5959

6060
export const createProxyRoute = ({
61-
baseUrl = '/',
61+
liveHostsManager,
6262
pathFilters = [/.*/],
6363
getConfigForReq = () => ({}),
6464
}) => ({
@@ -100,6 +100,7 @@ export const createProxyRoute = ({
100100
handler: async (req, h) => {
101101
const { payload, query } = req;
102102
const { path, method } = query;
103+
const baseUrl = await liveHostsManager.getLiveHost();
103104
const uri = toURL(baseUrl, path);
104105

105106
// Because this can technically be provided by a settings-defined proxy config, we need to

0 commit comments

Comments
 (0)