Skip to content

Instantly share code, notes, and snippets.

@gnurag
Last active August 29, 2015 14:01
Show Gist options
  • Select an option

  • Save gnurag/57de8fe4c4377c231444 to your computer and use it in GitHub Desktop.

Select an option

Save gnurag/57de8fe4c4377c231444 to your computer and use it in GitHub Desktop.
Apache configuration for securing ElasticSearch server.
<VirtualHost *:80>
DocumentRoot /var/www/html
ServerName app-example.rhcloud.com
ServerAlias alias1-example.rhcloud.com
ProxyRequests Off
ProxyVia Off
Header set Access-Control-Allow-Origin "*"
# Proxy Redirect for ElasticSearch.
ProxyPass /es http://localhost:9200 connectiontimeout=5 timeout=300
ProxyPassReverse /es http://localhost:9200
<LocationMatch /es>
Order deny,allow
Deny from all
</LocationMatch>
<LocationMatch "/es/.+/_search">
Order allow,deny
Allow from all
<Limit PUT DELETE>
Deny from all
</Limit>
</LocationMatch>
# Additionally, on SELinux enabled hosts
# # setsebool -P httpd_can_network_connect true
</VirtualHost>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment