Permalink
Browse files

Add a "health check" page for the Nginx proxy, usable in ELB/etc

If you set the `node.elasticsearch.nginx.allow_status` attribute to `true`,
Nginx will allow un-authenticated requests to `/status`, returning
the response from `curl -i localhost:9200` (a `HEAD` request).

Closes #70
  • Loading branch information...
1 parent 1b92448 commit fb61f6660e8412a0eefd05203afd79d6df6f0f0e @karmi karmi committed Mar 6, 2013
Showing with 13 additions and 0 deletions.
  1. +5 −0 attributes/proxy.rb
  2. +8 −0 templates/default/elasticsearch_proxy.conf.erb
View
@@ -24,6 +24,11 @@
#
default.elasticsearch[:nginx][:allow_cluster_api] = false
+# Allow responding to unauthorized requests for `/status`,
+# returning `curl -I localhost:9200`
+#
+default.elasticsearch[:nginx][:allow_status] = false
+
# Other Nginx proxy settings
#
default.elasticsearch[:nginx][:client_max_body_size] = "50M"
@@ -43,4 +43,12 @@ server {
}
+<% if node.elasticsearch[:nginx][:allow_status] %>
+ location /status {
+ proxy_method HEAD;
+ proxy_intercept_errors on;
+ proxy_pass http://localhost:9200/;
+ }
+<% end %>
+
}

0 comments on commit fb61f66

Please sign in to comment.