Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

server.basePath results in 404 #6665

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

server.basePath results in 404 #6665

nreese opened this issue Mar 25, 2016 · 14 comments

Comments

@nreese
Copy link
Contributor

@nreese 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
Copy link
Contributor Author

@nreese 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
Copy link
Member

@spalger 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
Copy link
Contributor Author

@nreese 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
Copy link

@abcfy2 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
Copy link
Contributor Author

@nreese 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
Copy link

@abhijitdeka abhijitdeka commented Apr 14, 2016

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

@nreese
Copy link
Contributor Author

@nreese 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
Copy link

@mingfang mingfang commented 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.

@Bargs
Copy link
Contributor

@Bargs 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
Copy link

@mingfang 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
Copy link

@LudwigHoff 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
Copy link
Member

@spalger 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?

@eperry
Copy link

@eperry 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.

@mangano-net
Copy link

@mangano-net 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
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
9 participants
You can’t perform that action at this time.