Proxy requests to ElasticSearch and Kibana using nginx

Proxy requests to AWS ElasticSearch and Kibana using nginx. I use the following nginx configuration, deployed via puppet template. The nginx proxy is an EC2 instance within an AutoScaling Group behind an ELB, with SSL termination.

resolver 169.254.169.253 valid=10s ipv6=off;

server {
  listen 8080;

  location / { 

    proxy_pass https://$elasticsearch_endpoint:443;
    proxy_redirect off;
    proxy_buffering off;

    proxy_http_version 1.1;
    proxy_set_header Connection "Keep-Alive";
    proxy_set_header Proxy-Connection "Keep-Alive";
  }

}

server {
  listen 8081;

  location / { 
    proxy_pass https://$elasticsearch_endpoint:443;
    proxy_redirect off;
    proxy_buffering off;

    proxy_http_version 1.1;
    proxy_set_header Connection "Keep-Alive";
    proxy_set_header Proxy-Connection "Keep-Alive";
  }
}

This configuration allow access to both kibana and elasticsearch, through this proxy endpoint.


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *