In AnyEvent::HTTP 2.25, a reusable connection can take precedence even when it was created under another proxy setting. When requests to the same website use different routes, separate the cache with route-specific sessionid values:

my $request = http_get 'http://www.example.com/',
    proxy => ['proxy.example', 8080],
    sessionid => 'office-route',
    sub {
        my ($body, $headers) = @_;
        print $headers->{Status};
    };

Include any account distinction needed by the application in that session identity. Reuse is confined to matching sessions. Set persistent false instead when a fresh connection is required.

For the public HTTP URL shown, the HTTP proxy list can supply candidate host/port values when an unauthenticated public route is permitted. The fragment assumes AnyEvent::HTTP is loaded and its event loop runs. Keep the request guard alive until completion; destroying it cancels the operation.

The proxy array takes hostname, port and optional HTTP scheme, not a credential-bearing URL. Authentication needs an appropriate caller-supplied Proxy-Authorization header. This plain HTTP example keeps routing and connection ownership separate from any HTTPS tunnel capability.

Erthyglow kevrennek