Merge "Proxy ElasticSearch with mod_rewrite."

This commit is contained in:
Jenkins 2013-10-16 21:34:22 +00:00 committed by Gerrit Code Review
commit d338dec842

View File

@ -1,21 +1,25 @@
<VirtualHost <%= scope.lookupvar("::logstash::web::vhost_name") %>:80> <VirtualHost <%= scope.lookupvar("::logstash::web::vhost_name") %>:80>
ServerName <%= scope.lookupvar("::logstash::web::vhost_name") %> ServerName <%= scope.lookupvar("::logstash::web::vhost_name") %>
ServerAdmin <%= scope.lookupvar("::logstash::web::serveradmin") %> ServerAdmin <%= scope.lookupvar("::logstash::web::serveradmin") %>
ErrorLog ${APACHE_LOG_DIR}/<%= scope.lookupvar("::logstash::web::vhost_name") %>-error.log ErrorLog ${APACHE_LOG_DIR}/<%= scope.lookupvar("::logstash::web::vhost_name") %>-error.log
LogLevel warn LogLevel warn
CustomLog ${APACHE_LOG_DIR}/<%= scope.lookupvar("::logstash::web::vhost_name") %>-access.log combined CustomLog ${APACHE_LOG_DIR}/<%= scope.lookupvar("::logstash::web::vhost_name") %>-access.log combined
<% if proxy_elasticsearch == true %> <IfModule mod_proxy.c>
# Proxy for elasticsearch _aliases, .*/_status, and .*/_search. <% if proxy_elasticsearch == true %>
<LocationMatch "^/elasticsearch/(_aliases|(.*/)?_status|(.*/)?_search|_cluster/health)$"> # Proxy GETs for elasticsearch _aliases, .*/_status, .*/_search,
ProxyPassMatch http://<%= scope.lookupvar("::logstash::web::discover_nodes")[0] %>/$1 connectiontimeout=15 timeout=120 # .*/_mapping, _cluster/health, and _nodes.
</LocationMatch> RewriteEngine on
ProxyPassReverse /elasticsearch/ http://<%= scope.lookupvar("::logstash::web::discover_nodes")[0] %>/ RewriteCond %{REQUEST_METHOD} GET
<% end %> RewriteRule ^/elasticsearch/(_aliases|(.*/)?_status|(.*/)?_search|(.*/)?_mapping|_cluster/health|_nodes)$ http://<%= scope.lookupvar("::logstash::web::discover_nodes")[0] %>/$1 [P]
ProxySet http://<%= scope.lookupvar("::logstash::web::discover_nodes")[0] %>/ connectiontimeout=15 timeout=120
ProxyPassReverse /elasticsearch/ http://<%= scope.lookupvar("::logstash::web::discover_nodes")[0] %>/
<% end %>
ProxyPass / http://127.0.0.1:5601/ retry=0 ProxyPass / http://127.0.0.1:5601/ retry=0
ProxyPassReverse / http://127.0.0.1:5601/ ProxyPassReverse / http://127.0.0.1:5601/
</IfModule>
</VirtualHost> </VirtualHost>