Hello, I am trying to route my elasticsearch.js queries through nginx (so that i can set the elasticsearch network.host to 127.0.0.1).
I added this to my nginx config so that anything that hits my domain name with _search get routed to 127.0.0.1:9200:
location ~ ^/.*/_search$ {
proxy_pass http://127.0.0.1:9200;
}
My search queries have scroll enabled since some of them can return quite a lot of records. If the search only brings back a few rows then it works fine but if it has to scroll it errors.
When it scrolls i get this error:
Request URL:https://mysite.mydomain.com/_search/scroll?scroll=30s
Request Method:POST
Status Code:400 Bad Request
Remote Address:serverIP:443
EDIT
When i scroll without it going through NGINX it looks like this:
Request URL:http://serverIP:9200/_search/scroll?scroll=30s
Request Method:POST
Status Code:200 OK
Remote Address:serverIP:9200
The only difference i see (appart from the domain vs server ip) is that the remote address on the none nginx is 9200 where as with NGINX is 443)
I guess i am missing a setting in NGINX to make this work
EDIT
Anyone have any ideas why scroll will not work?
Another edit... It doesnt matter if i use 443 or not - if i isolate the _search on any port it does the same..
It gives the following error:
No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:9000'
Elasticsearch config has the following:
http.cors.enabled: true
http.cors.allow-origin: "*"
if i add the header via nginx it gives this error:
The 'Access-Control-Allow-Origin' header contains multiple values '*, *', but only one is allowed
Why does it single out the scroll request but nothing else?
Thanks