Created
July 19, 2014 15:47
-
-
Save abrudtkuhl/09ce0301a2e12bd0a279 to your computer and use it in GitHub Desktop.
NGINX Proxy Config for Elasticsearch Readonly
This file contains hidden or 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
# 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