$proxy = 'http://'
    . rawurlencode($proxyUser) . ':'
    . rawurlencode($proxyPassword)
    . '@proxy.example:8080';

$client = new \Symfony\Component\HttpClient\CurlHttpClient([
    'proxy' => $proxy,
    'no_proxy' => 'localhost,internal.example',
]);
$response = $client->request('GET', 'https://api.example/items');
$status = $response->getStatusCode();

rawurlencode applies to the username and password separately. Encoding the entire URL would also encode the scheme and authority separators needed to locate the listener.

The HTTP proxy carries the HTTPS API connection through CONNECT. The proxy account does not replace API authentication, and forcing http_version to 2.0 is not required for proxy login.

The comma-separated no_proxy list selects intended direct hosts. Without explicit options, the component can consume its supported environment settings instead.

This constructs CurlHttpClient directly, requiring PHP's cURL transport. Symfony's generic factory can select another backend. For a remaining rejection, identify that selected transport and retain the proxy-stage error instead of moving the account into a destination Authorization header.

Erthyglow kevrennek