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

reverse-proxy: Unable to load "text!config" modules because of an unknown error. #1653

Closed
Yogu opened this issue Oct 12, 2014 · 13 comments
Closed
Labels
notabug When the issue is closed this label Indicates that it wasn't a bug

Comments

@Yogu
Copy link

Yogu commented Oct 12, 2014

I just installed kibana 4 Beta 1.1 on Ubuntu 14.04 and started bin/kibana. I configured nginx as a reverse proxy to the default 5601 port, so that kibna is avaiable at https://myserver. When I open that, I get the following error:

Unable to load "text!config" modules because of an unknown error.
text.get/xhr.onreadystatechange@https://theserver/index.js?_b=3439:42360:25

Error: Unable to load "text!config" modules because of an unknown error. (:0)
window.onerror@https://theserver/index.js?_b=3439:42863:5

The console displays about the same, and stdout contains this error entry:

{"@timestamp":"2014-10-12T19:40:41+02:00","status":"403","level":"ERROR","name":"Kibana","request_method":"GET","request":"/config_b=3439","path":"/config","query_string":"_b=3439","remote_addr":"127.0.0.1","remote_user":null,"http_version":"HTTP/1.0","content_length":"-","response_time":11,"message":"GET /config?_b=3439 403 11ms - -"}

The problem seems to be the reverse proxy, because if I directly access kibana at port 5601, the said request suceeds with 200.

@Yogu Yogu changed the title Unable to load "text!config" modules because of an unknown error. reverse-proxy: Unable to load "text!config" modules because of an unknown error. Oct 12, 2014
@TiNico22
Copy link

seems like a HTTP CORS (protection activated by default in ES 1.4)
check http.cors.* directive in elasticsearch.yml

@rashidkpc rashidkpc added the notabug When the issue is closed this label Indicates that it wasn't a bug label Oct 13, 2014
@rashidkpc
Copy link
Contributor

Thanks, we don't currently support running Kibana behind a reverse proxy. Given the http 403 you're seeing in the logs it would appear to be a permissions issue. As this does not appear to be a Kibana bug I'm going to go ahead and close this

@Yogu
Copy link
Author

Yogu commented Oct 13, 2014

Thanks for the tip with cors, I'll try it later.

Can we then use this as a feature request for supporting a reverse proxy? It is crucial to run kibana on a subdomain along with other services in the same server, and for us the best way to implement access control and ssl.

What exactly is the reason kibana does not support reverse proxys? Anything I can do?

@awesomescot-zz
Copy link

I'm having the exact same issue. Reverse proxy through nginx worked fine in kibana3. Has anyone figured out a good solution for access control and ssl?

@garam-lee
Copy link

It's a quite bit late to answer this, but... I solved it by add this option under the location : proxy_set_header Host $http_host;
I hope this helps you.

@karnauskas
Copy link

FYI

location / {
        proxy_pass http://<kibana ip>:<kibana port>$request_uri;
        proxy_set_header Host $http_host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }

@Yogu
Copy link
Author

Yogu commented Dec 10, 2014

Thanks @nkts and @garam-lee, that worked!

@molszanski
Copy link

@nkts, @garam-lee, thanks. Worked like a magic

@cihadoge
Copy link

You cannot set reverse proxy for kibana in folder, it should be root directory for the domain or subdomain.

@awesomescot
If you want to protect subdomain with password, you can do it in nginx also.

First run following command and create authentication user for nginx

sudo htpasswd -c /etc/nginx/.htpasswd admin

Then add following lines to end of your site's nginx configuration file.

server {
    listen 80;
    server_name stats.example.com;
    location / {
        # You can set password protection
        auth_basic "Restricted";
        auth_basic_user_file /etc/nginx/.htpasswd;
        proxy_pass  http://localhost:5601/;
        proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;
        proxy_set_header        Host            $host;
        proxy_set_header        X-Real-IP       $remote_addr;
        proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
    }
}

@DavidWittman
Copy link
Contributor

I'd like to see support for running Kibana 4 behind a reverse proxy with a prefixed path (e.g. /kibana).

@efouts
Copy link

efouts commented Feb 5, 2015

+1

@slav
Copy link

slav commented Mar 8, 2015

This code works for me for prefix for "kb4" (thanks to comments in ticket #1630)

  location ~* /kb4/.* {
        rewrite ^/kb4/(.*) /$1 break;
            proxy_pass http://127.0.0.1:5601;
            proxy_set_header Host $host;
            proxy_set_header  X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_send_timeout 600s;
        proxy_read_timeout 600s;
  }

@ghost
Copy link

ghost commented May 13, 2015

Works great - thank you! 😄

saintx pushed a commit to saintx/ctia that referenced this issue Apr 12, 2016
Kibana needs a few extra headers in order to handle reverse proxy
via nginx.  See: elastic/kibana#1653
saintx pushed a commit to saintx/ctia that referenced this issue Apr 13, 2016
Kibana needs a few extra headers in order to handle reverse proxy
via nginx.  See: elastic/kibana#1653
saintx pushed a commit to saintx/ctia that referenced this issue Apr 13, 2016
Kibana needs a few extra headers in order to handle reverse proxy
via nginx.  See: elastic/kibana#1653
saintx pushed a commit to saintx/ctia that referenced this issue Apr 14, 2016
Kibana needs a few extra headers in order to handle reverse proxy
via nginx.  See: elastic/kibana#1653
saintx pushed a commit to saintx/ctia that referenced this issue Apr 15, 2016
Kibana needs a few extra headers in order to handle reverse proxy
via nginx.  See: elastic/kibana#1653
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
notabug When the issue is closed this label Indicates that it wasn't a bug
Projects
None yet
Development

No branches or pull requests