Error when running Filebeat to send log to Elasticsearch behind a reverse proxy

Hi, I'm running filebeat in docker, when I check the container logs I get:

pipeline/output.go:105 Connection to backoff(elasticsearch(http://xxxxx.xxxxx.com:80/elastic)) established

Failed to perform any bulk index operations: 405 Method Not Allowed: {"error":"Incorrect HTTP method for uri [/] and method [POST], allowed: [GET, HEAD, DELETE]","status":405}

Clearly, the connection is established, but I think this is related to the Nginx conf that I have for Elasticsearch because all the request are redirected to the root [ / ], if I change the endpoint for my host it ignores it and send me to the root, where you have the message with the cluster info.