How to redirect the user to an external website with POST data?
In D8 for redirection you need to use RedirectResponse Object &amp; thats best way forward. However for improved security the same RedirectResponse object does not allow External URL redirections. For this You may want to use TrustedRedirectResponse. Sample below with assumption that you are trying to post data to the payment getway which can be added as a query string on the URL.

use Drupal\Core\Routing\TrustedRedirectResponse;

public function myController() {
  return new TrustedRedirectResponse($host.'?xyz=abc);
}


PREFERRED

However the above suggestion does has security implications as the data is exposed on the URL. Below solution is a minor tweak from your code.

$response = \Drupal::httpClient()-&gt;post($host, [
        'form_params' =&gt; $fields,
        'headers' =&gt; [
          'Content-type' =&gt; 'application/x-www-form-urlencoded',
        ],
    ]);


You can try below if you would like to capture response (If its an XML / JSON)

$response = \Drupal::httpClient()-&gt;post($host, [
        'form_params' =&gt; $fields,
        'headers' =&gt; [
          'Content-type' =&gt; 'application/x-www-form-urlencoded',
        ],
    ])-&gt;getBody()-&gt;getContents();