opcua-client-ext-transport-https · v4.4.x
Docs · Recipes

Corporate proxy

Route HTTPS through a corporate proxy via cURL options. Honours HTTP_PROXY / NO_PROXY environment variables when nothing is supplied explicitly.

CurlHttpClient exposes the extraCurlOptions constructor argument for anything cURL can do — including proxies.

Use the environment variables

cURL honours HTTPS_PROXY (and NO_PROXY) by default. If your shell exports them, no PHP-level change is needed:

bash env
export HTTPS_PROXY=http://proxy.corp.example:8080
export NO_PROXY=internal.corp.example

Set the proxy in code

php explicit HTTP proxy
new CurlHttpClient(
    verifyTls: true,
    extraCurlOptions: [
        CURLOPT_PROXY => 'http://proxy.corp.example:8080',
        CURLOPT_PROXYTYPE => CURLPROXY_HTTP,
    ],
);

Authenticated proxy

php proxy + basic auth
new CurlHttpClient(
    verifyTls: true,
    extraCurlOptions: [
        CURLOPT_PROXY => 'http://proxy.corp.example:8080',
        CURLOPT_PROXYUSERPWD => 'username:password',
    ],
);

For NTLM, add CURLOPT_PROXYAUTH => CURLAUTH_NTLM (the runtime needs cURL with NTLM compiled in).

SOCKS5

php SOCKS5
new CurlHttpClient(
    extraCurlOptions: [
        CURLOPT_PROXY => 'socks5h://proxy.corp.example:1080',
    ],
);

socks5h:// resolves DNS through the proxy — usually what you want behind restrictive firewalls.

Bypass the proxy for specific hosts

php bypass list
new CurlHttpClient(
    extraCurlOptions: [
        CURLOPT_PROXY => 'http://proxy.corp.example:8080',
        CURLOPT_NOPROXY => 'localhost,127.0.0.1,*.internal.corp.example',
    ],
);