Error writing to outputs.http: Post https://xxxx/telegraf: unexpected EOF

In my current setup, I have a proxy sitting before the endpoint. When there is no proxy, I am able to reach the server and upload all data successfully.

When I perform a curl operation with proxy in between the data is also uploaded successfully to the endpoint.
curl -k “https://proxy_user:proxy_pass@proxy_address” “https://endpoint/telegraf” -u user:password --data-binary ‘cpu_load_short,host=server01,region=us-west value=0.64 1434055562000000000’ -v -i

The endpoint returns 2xx and all is well.

When I use the same config for the telegraf server, when trying to upload I get unexpected EOF and the request does not even go to proxy.

./launch_telegraf.sh
2020-02-14T19:57:32Z I! Starting Telegraf
2020-02-14T19:57:32Z I! Loaded inputs: cpu mem swap disk diskio procstat procstat postfix exec exec postgresql_extensible
2020-02-14T19:57:32Z I! Loaded aggregators:
2020-02-14T19:57:32Z I! Loaded processors:
2020-02-14T19:57:32Z I! Loaded outputs: http file
2020-02-14T19:57:32Z I! Tags enabled: appliance_id=1234 tenant=appliances
2020-02-14T19:57:32Z I! [agent] Config: Interval:15s, Quiet:false, Hostname:"", Flush Interval:15s

swap,appliance_id=1234,tenant=appliances used_percent=0 1581710265000000000
mem,appliance_id=1234,tenant=appliances used_percent=11.283904556998545 1581710265000000000
2020-02-14T19:57:55Z E! [agent] Error writing to outputs.http: Post https://endpoint/telegraf: unexpected EOF

My outputs.http looks like follows :
I have correctly set the environment variables for http_proxy and https_proxy as well.

[[outputs.http]]
url="$TELEGRAF_SERVER"
username="$TELEGRAF_USER"
password="$TELEGRAF_PWD"
insecure_skip_verify = true

Any suggestions or help is appreciated.

Hemil