Last active
September 11, 2020 09:08
-
-
Save sthomp/1e9eeda7edcc69569ba2 to your computer and use it in GitHub Desktop.
nginx config to proxy connections to kibana on aws
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | |
} | |
} | |
} |
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;
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
proxy_pass_request_headers off;
==> thanks! 🍺