Skip to content

Instantly share code, notes, and snippets.

@sthomp
Last active September 11, 2020 09:08
Show Gist options
  • Save sthomp/1e9eeda7edcc69569ba2 to your computer and use it in GitHub Desktop.
Save sthomp/1e9eeda7edcc69569ba2 to your computer and use it in GitHub Desktop.
nginx config to proxy connections to kibana on aws
worker_processes 1;
events {
worker_connections 1024;
}
http{
server {
listen 80;
server_name localhost;
# redirect /
location = / {
rewrite ^ /_plugin/kibana/ redirect;
}
# redirect /dashboard
location = /dashboard {
rewrite ^ /_plugin/kibana/#/dashboard/My-Dashboard?_g=(refreshInterval:(display:'1%20minute',section:2,value:60000),time:(from:now-7d,mode:quick,to:now)) redirect;
}
location / {
proxy_pass https://<my-search-domain>.us-east-1.es.amazonaws.com;
proxy_pass_request_headers off;
auth_basic "Restricted";
auth_basic_user_file htpasswd;
}
}
}
@tieum
Copy link

tieum commented Aug 10, 2016

proxy_pass_request_headers off; ==> thanks! 🍺

@ibrahima
Copy link

If the reason for turning off proxy_pass_request_headers is because of basic auth, I think it's easier to just remove the Authorization header. Newer versions of Kibana need a kbn-version header to work and removing headers breaks that.

    proxy_set_header    Authorization "";
    proxy_hide_header Authorization;

@panchicore
Copy link

applying @ibrahima feedback, this works for me:

server {
    listen 80 default_server;
    listen [::]:80 default_server;
    server_name localhost;

    location = / {
      rewrite ^ /_plugin/kibana/ redirect;
    }

    location / {
      proxy_pass            https://<my-search-domain>.us-east-1.es.amazonaws.com;
      proxy_set_header    Authorization "";
      proxy_hide_header  Authorization;
    }
  }

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