Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 22 additions & 8 deletions docker/elastic-proxy/elastic.conf
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,38 @@ server {
server_name _;
client_max_body_size 50m;

location /ping {
add_header Content-Type application/json;
return 200 '{"status":"success","result":"Proxy alive"}';
location /health {
access_log off;

proxy_pass ${ELASTICSEARCH_URL}/_cluster/health;
proxy_ssl_verify off;
proxy_redirect off;
proxy_set_header Authorization $elastic_authorization;
proxy_pass_header Authorization;

proxy_connect_timeout 5s;
proxy_send_timeout 5s;
proxy_read_timeout 5s;
}

location ~ ^/([a-z][a-z_,-]*)/(_search|_msearch)$ {
limit_except GET POST {
deny all;
limit_except GET POST OPTIONS {
deny all;
}

if ($request_method = 'OPTIONS') {
return 204;
}

proxy_pass ${ELASTICSEARCH_URL};
proxy_ssl_verify off;
proxy_redirect off;
proxy_set_header Authorization $elastic_authorization;
proxy_pass_header Authorization;
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;
proxy_pass_header Access-Control-Allow-Origin;
proxy_pass_header Access-Control-Allow-Methods;
proxy_hide_header Access-Control-Allow-Headers;
add_header 'Access-Control-Allow-Origin' '*' always;
add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,Authorization' always;
}
}