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

Comments

Projects
None yet
@Yogu

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 from Unable to load "text!config" modules because of an unknown error. to reverse-proxy: Unable to load "text!config" modules because of an unknown error. Oct 12, 2014

@TiNico22

This comment has been minimized.

Show comment
Hide comment
@TiNico22

TiNico22 Oct 12, 2014

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

TiNico22 commented Oct 12, 2014

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 label Oct 13, 2014

@rashidkpc

This comment has been minimized.

Show comment
Hide comment
@rashidkpc

rashidkpc Oct 13, 2014

Member

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

Member

rashidkpc commented Oct 13, 2014

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

@rashidkpc rashidkpc closed this Oct 13, 2014

@Yogu

This comment has been minimized.

Show comment
Hide comment
@Yogu

Yogu 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?

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

This comment has been minimized.

Show comment
Hide comment
@awesomescot

awesomescot Oct 23, 2014

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?

awesomescot commented Oct 23, 2014

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

This comment has been minimized.

Show comment
Hide comment
@garam-lee

garam-lee Nov 6, 2014

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.

garam-lee commented Nov 6, 2014

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

This comment has been minimized.

Show comment
Hide comment
@karnauskas

karnauskas Nov 10, 2014

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;
    }

karnauskas commented Nov 10, 2014

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

This comment has been minimized.

Show comment
Hide comment
@Yogu

Yogu Dec 10, 2014

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

Yogu commented Dec 10, 2014

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

@molszanski

This comment has been minimized.

Show comment
Hide comment
@molszanski

molszanski Dec 18, 2014

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

molszanski commented Dec 18, 2014

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

@cihadoge

This comment has been minimized.

Show comment
Hide comment
@cihadoge

cihadoge Jan 11, 2015

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;
    }
}

cihadoge commented Jan 11, 2015

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

This comment has been minimized.

Show comment
Hide comment
@DavidWittman

DavidWittman Jan 24, 2015

Contributor

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

Contributor

DavidWittman commented Jan 24, 2015

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

@efouts

This comment has been minimized.

Show comment
Hide comment
@efouts

efouts commented Feb 5, 2015

+1

@slav

This comment has been minimized.

Show comment
Hide comment
@slav

slav 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;
  }

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

This comment has been minimized.

Show comment
Hide comment
@ghost

ghost May 13, 2015

Works great - thank you! 😄

ghost commented May 13, 2015

Works great - thank you! 😄

saintx pushed a commit to saintx/ctia that referenced this issue Apr 12, 2016

Alexander R. Saint Croix
Add support for nginx reverse proxy to kibana.
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

Alexander R. Saint Croix
Add support for nginx reverse proxy to kibana.
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

Alexander R. Saint Croix
Add support for nginx reverse proxy to kibana.
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

Alexander R. Saint Croix
Add support for nginx reverse proxy to kibana.
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

Alexander R. Saint Croix
Add support for nginx reverse proxy to kibana.
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