Skip to content

Instantly share code, notes, and snippets.

@abrudtkuhl
Created July 19, 2014 15:47
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save abrudtkuhl/09ce0301a2e12bd0a279 to your computer and use it in GitHub Desktop.
Save abrudtkuhl/09ce0301a2e12bd0a279 to your computer and use it in GitHub Desktop.
NGINX Proxy Config for Elasticsearch Readonly
# This config is based @karmi's answer on this Stackoverflow post: http://stackoverflow.com/a/14120342/12442
#
# Run me with:
#
# $ nginx -c path/to/this/file
#
# All requests except GET are denied.
worker_processes 1;
pid nginx.pid;
events {
worker_connections 1024;
}
http {
server {
listen 8080;
server_name search.example.com;
error_log elasticsearch-errors.log;
access_log elasticsearch.log;
location / {
if ($request_method !~ "GET") {
return 403;
break;
}
proxy_pass http://localhost:9200;
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment