Server on port 5603?


(Varun Sharma) #1

So when i run kibana (5.4.1) in development more using 'npm start', the APIs that i add to the Hapi.js server object can be accessed via 5603 and not 5601 where actual kibana resides, this behavior is not present when I'm running kibana in production (non dev mode) with my plugins, am I doing something wrong?
Could you explain or point me to some resources explaining this behavior?


(poojagupta) #2

Hi,

Which port is mentioned in your kibana.yml file?
also can you please share the logs after starting the kibana service?


(Varun Sharma) #3

kibana.yml is the standard one, Kibana is being hosted on 5601 and everything is as it should when run from optimized bundle. I am talking about development mode of Kibana in which the my api's are getting hosted on 5603.


(Felix Stürmer) #4

In development mode there is a proxy added in front of Kibana to force developers to support base paths that differ from /.


(Varun Sharma) #5

That I'm aware of, and I always account for it using :-
server.config().get('server.basePath') ; //For server side
and
chrome.getBasePath() //For angularJs

But the APIs which should be :-
https://localhost:5601/kqc/api/someApi

Are being hosted on (Only in Dev mode) :-
https://localhost:5603/kqc/api/someApi

Going by your comment, I'm getting why it's happening but how to rectify this issue?
The way I set my routing :-

	const basePath = serverConfig.get('server.basePath');
	configurations.apiConfig.listPath = basePath + configurations.apiConfig.listPath || "/someApi";

	kibanaServer.route({
		method: 'GET',
		path: apiConfig.listPath,
		handler: handleReq
	});

I checked Documents :- https://www.elastic.co/guide/en/kibana/5.4/development-basepath.html
But I don't see them doing it any different or maybe I'm missing something.


(Felix Stürmer) #6

If you are registering a route on the server-side using server.route(), you don't need to include the basePath in the path argument. Only when querying the API from the client side or redirecting to another url on the server needs that path to be manually added as a prefix.


(Varun Sharma) #7

Well, my current concern is the port on which it is being hosted. Do you have any idea on why it would host the APIs on 5603?


(Felix Stürmer) #8

The setup is such, that in dev mode we start two http servers:

  • A so-called "base path proxy" on port 5601, which acts as a reverse proxy for Kibana with a randomly generated url prefix. That is the reason why, when accessing localhost:5601, you will be redirected to something like localhost:5601/abc/app/kibana.
  • The main Kibana http server on port 5603, which serves the static assets as well as the api routes.

The server on port 5603 is not intended to be accessed directly, but instead through the reverse proxy at 5601. If you think that you don't need the forcing function to support arbitrary base paths, you can disable the random path prefix using the --no-base-path argument to npm start as in npm start -- --no-base-path.

This is also documented in the "Contributing to Kibana" chapter of the documentation.


(system) #9

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.