server.basePath results in 404 #6665

Closed
nreese opened this Issue Mar 25, 2016 · 14 comments

Comments

Projects
None yet
9 participants
@nreese
Contributor

nreese commented Mar 25, 2016

I am running kibana 4.4.1 on RHEL 7.2

Everything works when the kibana.yml file does not contain the setting server.basePath. However, when basePath is set to server.basePath: "/kibana4" all HTTP requests result in 404s. For example http://x.x.x.x:5601/kibana4 results in a 404 and http://x.x.x.x:5601 gets redirected to http://x.x.x.x:5601/kibana4/app/kibana which also results to a 404.

Am I using server.basePath correctly? Why all the 404s?

@nreese

This comment has been minimized.

Show comment
Hide comment
@nreese

nreese Mar 28, 2016

Contributor

Here is some more information...

curl http://x.x.x.x:5601/ returns

<script>
   var hashRoute = '/kibana4/app/kibana';
   var defaultRoute = '/kibana4/app/kibana';
   ...
</script>

curl http://x.x.x.x:5601/kibana4/app/kibana returns

{"statusCode":404,"error":"Not Found"}

Why does '/kibana4/app/kibana' return a 404?

Nathan

Contributor

nreese commented Mar 28, 2016

Here is some more information...

curl http://x.x.x.x:5601/ returns

<script>
   var hashRoute = '/kibana4/app/kibana';
   var defaultRoute = '/kibana4/app/kibana';
   ...
</script>

curl http://x.x.x.x:5601/kibana4/app/kibana returns

{"statusCode":404,"error":"Not Found"}

Why does '/kibana4/app/kibana' return a 404?

Nathan

@spalger

This comment has been minimized.

Show comment
Hide comment
@spalger

spalger Mar 28, 2016

Member

@nreese this is because the basepath should be removed by the proxy before requests are sent to Kibana. This is generally called "request rewriting" and any number of posts should exist to show you how to set that up for your proxy.

Member

spalger commented Mar 28, 2016

@nreese this is because the basepath should be removed by the proxy before requests are sent to Kibana. This is generally called "request rewriting" and any number of posts should exist to show you how to set that up for your proxy.

@spalger spalger closed this Mar 28, 2016

@nreese

This comment has been minimized.

Show comment
Hide comment
@nreese

nreese Mar 28, 2016

Contributor

Can you please clarify how this works? I am really stuck and can not find
much help in the documenation

On Mon, Mar 28, 2016 at 2:45 PM, Spencer notifications@github.com wrote:

@nreese https://github.com/nreese this is because the basepath should
be removed by the proxy before requests are sent to Kibana. This is
generally called "request rewriting" and any number of posts should exist
to show you how to set that up for your proxy.


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
#6665 (comment)

Contributor

nreese commented Mar 28, 2016

Can you please clarify how this works? I am really stuck and can not find
much help in the documenation

On Mon, Mar 28, 2016 at 2:45 PM, Spencer notifications@github.com wrote:

@nreese https://github.com/nreese this is because the basepath should
be removed by the proxy before requests are sent to Kibana. This is
generally called "request rewriting" and any number of posts should exist
to show you how to set that up for your proxy.


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
#6665 (comment)

@abcfy2

This comment has been minimized.

Show comment
Hide comment

abcfy2 commented Apr 12, 2016

Same issue here. And I find this config by nginx could work: https://discuss.elastic.co/t/4-3-0-how-to-configure-your-nginx-balancer-and-apache-reverse-proxy/37351/5

@nreese

This comment has been minimized.

Show comment
Hide comment
@nreese

nreese Apr 12, 2016

Contributor

I eventually figured it out and posted an answer to Stack overflow using
HAProxy
http://stackoverflow.com/questions/36266776/kibana-server-basepath-results-in-404.
I did not expect server.basePath to only add the base path to outgoing URLs
and not handle them on incoming traffic as well.

On Tue, Apr 12, 2016 at 8:51 AM, Feng Yu notifications@github.com wrote:

Same issue here. And I find this config by nginx could work:
https://discuss.elastic.co/t/4-3-0-how-to-configure-your-nginx-balancer-and-apache-reverse-proxy/37351/5


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
#6665 (comment)

Contributor

nreese commented Apr 12, 2016

I eventually figured it out and posted an answer to Stack overflow using
HAProxy
http://stackoverflow.com/questions/36266776/kibana-server-basepath-results-in-404.
I did not expect server.basePath to only add the base path to outgoing URLs
and not handle them on incoming traffic as well.

On Tue, Apr 12, 2016 at 8:51 AM, Feng Yu notifications@github.com wrote:

Same issue here. And I find this config by nginx could work:
https://discuss.elastic.co/t/4-3-0-how-to-configure-your-nginx-balancer-and-apache-reverse-proxy/37351/5


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
#6665 (comment)

@abhijitdeka

This comment has been minimized.

Show comment
Hide comment
@abhijitdeka

abhijitdeka Apr 14, 2016

Please add sufficient example with server.basepth. Lot of users are struggling because of lack of documentation.

Please add sufficient example with server.basepth. Lot of users are struggling because of lack of documentation.

@nreese

This comment has been minimized.

Show comment
Hide comment
@nreese

nreese Apr 15, 2016

Contributor

My recommendation would be to re-word the verbiage for the
server.basePath configuration
option in the documentation. The current wording does little to help
explain how kibana uses basePath. My first instincts were to append the
basePath to the URL. This was incorrect and resulted in 404s. Maybe
something like the below would point users in the right direction

Enables you to specify a path to mount Kibana at if you are running behind
a proxy. The basePath value does not change the address that kibana listens
on, instead, your proxy is expected to remove the basePath value before
forwarding requests to Kibana. This setting cannot end in a slash (/).

On Thu, Apr 14, 2016 at 4:19 AM, abhijit notifications@github.com wrote:

Please add sufficient example with server.basepth. Lot of users are
struggling because of lack of documentation.


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
#6665 (comment)

Contributor

nreese commented Apr 15, 2016

My recommendation would be to re-word the verbiage for the
server.basePath configuration
option in the documentation. The current wording does little to help
explain how kibana uses basePath. My first instincts were to append the
basePath to the URL. This was incorrect and resulted in 404s. Maybe
something like the below would point users in the right direction

Enables you to specify a path to mount Kibana at if you are running behind
a proxy. The basePath value does not change the address that kibana listens
on, instead, your proxy is expected to remove the basePath value before
forwarding requests to Kibana. This setting cannot end in a slash (/).

On Thu, Apr 14, 2016 at 4:19 AM, abhijit notifications@github.com wrote:

Please add sufficient example with server.basepth. Lot of users are
struggling because of lack of documentation.


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
#6665 (comment)

@mingfang

This comment has been minimized.

Show comment
Hide comment
@mingfang

mingfang Sep 17, 2016

This is ridiculous. Setting the basepath should actually change the basepath for kibana and should not require any reverse proxy rewriting. This kind of behavior is pretty 101 in webapps.

This is ridiculous. Setting the basepath should actually change the basepath for kibana and should not require any reverse proxy rewriting. This kind of behavior is pretty 101 in webapps.

@Bargs

This comment has been minimized.

Show comment
Hide comment
@Bargs

Bargs Sep 20, 2016

Contributor

I think there's some confusion here. basePath exists specifically for people who want to run Kibana behind a proxy. It's not meant to be a useful feature in any other respect. As @nreese said we can probably improve the documentation to make this more clear. I've opened a PR to improve the wording of the docs: #8375

Contributor

Bargs commented Sep 20, 2016

I think there's some confusion here. basePath exists specifically for people who want to run Kibana behind a proxy. It's not meant to be a useful feature in any other respect. As @nreese said we can probably improve the documentation to make this more clear. I've opened a PR to improve the wording of the docs: #8375

@mingfang

This comment has been minimized.

Show comment
Hide comment
@mingfang

mingfang Sep 30, 2016

I'm aware of what basePath is and I'm using it behind a reverse proxy.
I'm objecting to the fact that I have to do url rewrites on the proxy to get this to work.

mingfang commented Sep 30, 2016

I'm aware of what basePath is and I'm using it behind a reverse proxy.
I'm objecting to the fact that I have to do url rewrites on the proxy to get this to work.

@LudwigHoff

This comment has been minimized.

Show comment
Hide comment
@LudwigHoff

LudwigHoff Dec 16, 2016

Me too. I also am aware of what basePath is and I'm using it behind a reverse proxy.
I'm objecting to the fact that I have to do url rewrites on the proxy to get this to work.

Please...

LudwigHoff commented Dec 16, 2016

Me too. I also am aware of what basePath is and I'm using it behind a reverse proxy.
I'm objecting to the fact that I have to do url rewrites on the proxy to get this to work.

Please...

@spalger

This comment has been minimized.

Show comment
Hide comment
@spalger

spalger Dec 16, 2016

Member

It would probably be trivial for us to support this, but we can't just change the way basePath works at this point. What do you think about #9522?

Member

spalger commented Dec 16, 2016

It would probably be trivial for us to support this, but we can't just change the way basePath works at this point. What do you think about #9522?

@mbaig25 mbaig25 referenced this issue in vfarcic/docker-flow-proxy Feb 10, 2017

Closed

URL rewriting functionality #133

@eperry

This comment has been minimized.

Show comment
Hide comment
@eperry

eperry Mar 15, 2017

I agree, I just stumbled across this same exact issue. creates a lot of extra work for no reason. If you updating the basepath it should change it. Having different URL's makes it difficult to trouble shoot.

eperry commented Mar 15, 2017

I agree, I just stumbled across this same exact issue. creates a lot of extra work for no reason. If you updating the basepath it should change it. Having different URL's makes it difficult to trouble shoot.

@jochenkressin jochenkressin referenced this issue in floragunncom/search-guard-kibana-plugin May 11, 2017

Closed

can't start kibana with custom server basePath #22

@poor-bob poor-bob referenced this issue in pires/kubernetes-elasticsearch-cluster Aug 19, 2017

Closed

could not access kibana #119

@mangano-net

This comment has been minimized.

Show comment
Hide comment
@mangano-net

mangano-net Nov 29, 2017

I got this working on this system:

[09:39:17] [root@hostname:]# yum list installed | grep kibana
kibana.x86_64 5.5.1-1 @/kibana-5.5.1-x86_64
[09:39:29] [root@hostname:]# yum list installed | grep httpd
httpd24u.x86_64 2.4.27-1.ius.el6 @ius
httpd24u-filesystem.noarch 2.4.27-1.ius.el6 @ius
httpd24u-mod_ldap.x86_64 2.4.27-1.ius.el6 @ius
httpd24u-mod_ssl.x86_64 1:2.4.27-1.ius.el6 @ius
httpd24u-tools.x86_64 2.4.27-1.ius.el6 @ius
[09:39:34] [root@hostname:]# uname -r
2.6.32-696.6.3.el6.x86_64
[09:39:47] [root@hostname:]# cat /etc/redhat-release
CentOS release 6.9 (Final)
[09:39:58] [root@hostname:]#

  • Removed 'server.basePath'
    Here is full 'kibana.yml' file:

[09:39:58] [root@hostname:~]# cat /etc/kibana/kibana.yml
server.port: 5601
server.name: Kibana-STG
server.host: 0.0.0.0
kibana.index: .kibana
kibana.defaultAppId: discover
logging.dest: /var/log/kibana/kibana.log
i18n.defaultLocale: "en"

elasticsearch.url: http://localhost:9200
[09:42:35] [root@hostname:~]#

  • Added this proxy setup on Apache

ProxyPreserveHost On
ProxyRequests On
ProxyPass / http://localhost:5601/ timeout=200
ProxyPassReverse / http://localhost:5601/

mangano-net commented Nov 29, 2017

I got this working on this system:

[09:39:17] [root@hostname:]# yum list installed | grep kibana
kibana.x86_64 5.5.1-1 @/kibana-5.5.1-x86_64
[09:39:29] [root@hostname:]# yum list installed | grep httpd
httpd24u.x86_64 2.4.27-1.ius.el6 @ius
httpd24u-filesystem.noarch 2.4.27-1.ius.el6 @ius
httpd24u-mod_ldap.x86_64 2.4.27-1.ius.el6 @ius
httpd24u-mod_ssl.x86_64 1:2.4.27-1.ius.el6 @ius
httpd24u-tools.x86_64 2.4.27-1.ius.el6 @ius
[09:39:34] [root@hostname:]# uname -r
2.6.32-696.6.3.el6.x86_64
[09:39:47] [root@hostname:]# cat /etc/redhat-release
CentOS release 6.9 (Final)
[09:39:58] [root@hostname:]#

  • Removed 'server.basePath'
    Here is full 'kibana.yml' file:

[09:39:58] [root@hostname:~]# cat /etc/kibana/kibana.yml
server.port: 5601
server.name: Kibana-STG
server.host: 0.0.0.0
kibana.index: .kibana
kibana.defaultAppId: discover
logging.dest: /var/log/kibana/kibana.log
i18n.defaultLocale: "en"

elasticsearch.url: http://localhost:9200
[09:42:35] [root@hostname:~]#

  • Added this proxy setup on Apache

ProxyPreserveHost On
ProxyRequests On
ProxyPass / http://localhost:5601/ timeout=200
ProxyPassReverse / http://localhost:5601/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment