Use a Separate Erlang httpc Profile for Direct Requests
Start a named profile with no proxy configured, pass its name on each direct call and stop it with the owning component.
Leave the shared proxy profile in place and create a separate direct-work profile. Inside an application with inets running:
{ok, ProfilePid} =
inets:start(httpc, [{profile, direct_work}]).A newly created profile has no proxy unless the application sets one. Select it explicitly on the request:
httpc:request(
get,
{"http://example.com/", []},
[],
[],
direct_work
).Omitting direct_work on a later call selects the default profile again. Inspect this profile's routing options with httpc:get_options([proxy, https_proxy], direct_work).
The profile also owns cookies and connection handling. Keep that state with its component and stop the profile with inets:stop(httpc, ProfilePid) when the workload ends. There is no need to rewrite httpc_manager's internal state or terminate a shared manager to obtain this direct route.