ERROR: Invalid Host Header Requests

We are running Elasticsearch v6.8.0 on AWS OpenSearch Service, through VPN, and we use following elasticsearch client in our NodeJS server: elasticsearch - npm
Our client version is v16.7.2. When I check the metrics on AWS CloudWatch, I observe that we are getting Invalid Host Header request errors.

I have tried creating client instance using different notations as suggested here:

const elasticsearchClient = new ElasticsearchClient.Client({
  host: elasticsearchUrl,
  requestTimeout: 120000,


const elasticsearchClient = new ElasticsearchClient.Client({
  host: {
    protocol: 'https',
    host: '**********',
    port: '443',
    path: '/'
  requestTimeout: 120000,

But still no luck, we are getting this error in the CloudWatch. I also tried switching to the new version of the Elasticsearch client, which is:

But result is same, after running queries I am able to observe these warnings in the metrics. I suspect issue is not client oriented and should be fixed by the Elasticsearch configuration, but I could not find a related configuration.

OpenSearch/OpenDistro are AWS run products and differ from the original Elasticsearch and Kibana products that Elastic builds and maintains. You may need to contact them directly for further assistance.

(This is an automated response from your friendly Elastic bot. Please report this post if you have any suggestions or concerns :elasticheart: )

Welcome to our community! :smiley:

Unfortunately we may not be able to help there as aws runs a fork of Elasticsearch with unknown changes to it. Hopefully one of the clients team can stop by and comment further though!

Hello warkolm thank you for welcoming, OpenSearch is derived from Elasticsearch 7.10.2. As I mentioned, we are using the Elasticsearch 6.8.0 on AWS, we did not switch to OpenSearch and as far as I know, there are no explicit changes made by AWS to this served version 6.8.0. It should be Can we please reconsider from this point of view.

Elasticsearch 6.8.0 is EOL and no longer supported. Please upgrade ASAP.

(This is an automated response from your friendly Elastic bot. Please report this post if you have any suggestions or concerns :elasticheart: )

I understand that, but the build hash doesn't match the one that we released, so there are definitely unknown changes to Elasticsearch involved.

You are using an AWS managed service, which means we do not know what changes they may or may not have made, what plugins they may be running that have an impact on this nor how any proxies or layers between you and the nodes are set up. The official clients are not and have never been tested against this kind of setup, so this is something you need to address with AWS support.

Thank you for the response. I will check with AWS support.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.