Skip to content

NEST Refresh() method fails if using IIS proxy  #562

Closed
@maximpashuk

Description

@maximpashuk

NEST do a POST request for Refresh method and does not set Content-Length header.

In common case NEST should set it, because POST request implies that you have message body, so you always should set Content-Length for POST requests (if no body provided then you should set zero)

http://www.w3.org/Protocols/rfc2616/rfc2616.txt

Elasticsearch is using Netty web server, that is tolerant and allows POST requests without Content-Length provided.

BUT if I use IIS reverse proxy behind of elasticsearch, then IIS not allowing such requests

1

If I use elasticsearch-head, then all is OK, elasticsearch-head is setting Content-Length:0 for Refresh method

2

I am not familiar with code, but I think changes required in file HttpConnection.cs

https://github.com/elasticsearch/elasticsearch-net/blob/f85ce38eca2d1ed13f4f5a094c13d9ec1da77b0a/src/Elasticsearch.Net/Connection/HttpConnection.cs

in method CreateWebRequest add something like

if (method == "Post"){
myReq.ContentLength = 0;
}

oк using IRequestConnectionConfiguration interface

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions