# Server on port 5603?

**URL:** <https://discuss.elastic.co/t/server-on-port-5603/98657>\
**Category:** Kibana\
**Created:** [August 29, 2017, 9:16am UTC](https://discuss.elastic.co/t/server-on-port-5603/98657 "2017-08-29T09:16:37Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![varundbest](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/varundbest/32/48066_2.png) [@varundbest](https://discuss.elastic.co/u/varundbest)\
**Post date:** [August 29, 2017, 9:16am UTC](https://discuss.elastic.co/t/server-on-port-5603/98657/1 "2017-08-29T09:16:37Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![poojagupta](https://avatars.discourse-cdn.com/v4/letter/p/5daacb/32.png) [@poojagupta](https://discuss.elastic.co/u/poojagupta)\
**Post date:** [August 30, 2017, 9:57am UTC](https://discuss.elastic.co/t/server-on-port-5603/98657/2 "2017-08-30T09:57:38Z")

</div>

Hi,

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

---

<div class="post-metadata">

**Author:** ![varundbest](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/varundbest/32/48066_2.png) [@varundbest](https://discuss.elastic.co/u/varundbest)\
**Post date:** [August 30, 2017, 10:12am UTC](https://discuss.elastic.co/t/server-on-port-5603/98657/3 "2017-08-30T10:12:05Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![weltenwort](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/weltenwort/32/53885_2.png) [@weltenwort](https://discuss.elastic.co/u/weltenwort)\
**Post date:** [August 30, 2017, 5:11pm UTC](https://discuss.elastic.co/t/server-on-port-5603/98657/4 "2017-08-30T17:11:06Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![varundbest](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/varundbest/32/48066_2.png) [@varundbest](https://discuss.elastic.co/u/varundbest)\
**Post date:** [August 31, 2017, 2:50am UTC](https://discuss.elastic.co/t/server-on-port-5603/98657/5 "2017-08-31T02:50:31Z")

</div>

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](https://localhost:5601/kqc/api/someApi)

Are being hosted on (Only in Dev mode) :-  
[https://localhost:5603/kqc/api/someApi](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](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.

---

<div class="post-metadata">

**Author:** ![weltenwort](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/weltenwort/32/53885_2.png) [@weltenwort](https://discuss.elastic.co/u/weltenwort)\
**Post date:** [August 31, 2017, 8:38am UTC](https://discuss.elastic.co/t/server-on-port-5603/98657/6 "2017-08-31T08:38:20Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![varundbest](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/varundbest/32/48066_2.png) [@varundbest](https://discuss.elastic.co/u/varundbest)\
**Post date:** [August 31, 2017, 11:08am UTC](https://discuss.elastic.co/t/server-on-port-5603/98657/7 "2017-08-31T11:08:51Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![weltenwort](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/weltenwort/32/53885_2.png) [@weltenwort](https://discuss.elastic.co/u/weltenwort)\
**Post date:** [August 31, 2017, 4:38pm UTC](https://discuss.elastic.co/t/server-on-port-5603/98657/8 "2017-08-31T16:38:09Z")

</div>

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](https://www.elastic.co/guide/en/kibana/current/development-basepath.html#_basepathproxy_in_dev_mode).

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [September 28, 2017, 4:38pm UTC](https://discuss.elastic.co/t/server-on-port-5603/98657/9 "2017-09-28T16:38:10Z")

</div>

Closed on September 28, 2017, 4:38pm UTC

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