Mojo::U...::Proxy(3)
π Mojo::UserAgent::Proxy(3) β the user agent proxy manager, bestie edition
okay so real talk: this is a page from the User Contributed Perl Documentation section of the manual, and the whole thing is literally called Mojo::UserAgent::Proxy (the header up top just abbreviates it to Mojo::U...::Proxy because man pages are dramatic and love a cliffhanger). It's a proxy manager. For a user agent. It manages proxies. Slay.
β¨ SYNOPSIS β¨
like, here's the whole vibe in five lines:
use Mojo::UserAgent::Proxy;
my $proxy = Mojo::UserAgent::Proxy->new;
$proxy->detect;
say $proxy->http;
that's it. that's the whole thing. make one, detect stuff, print the http proxy. iconic behaviour honestly.
πΈ DESCRIPTION πΈ
Mojo::UserAgent::Proxy manages proxy servers for Mojo::UserAgent. no cap, that's its entire job and it does it well. it's the little guy behind the scenes making sure your requests go through the right door. π«Ά
π ATTRIBUTES π
Mojo::UserAgent::Proxy implements the following attributes. (yes, "implements". very main character of it.)
π http
my $http = $proxy->http;
$proxy = $proxy->http('socks://sri:secret@127.0.0.1:8080');
the proxy server to use for HTTP and WebSocket requests. that's the one. notice the example uses a socks:// URL β yes bestie, socks is on the menu. π
π https
my $https = $proxy->https;
$proxy = $proxy->https('http://sri:secret@127.0.0.1:8080');
the proxy server to use for HTTPS and WebSocket requests. same deal, different scheme. yes, both of them cover WebSocket requests β don't @ me, that's what the page says.
π¦ not
my $not = $proxy->not;
$proxy = $proxy->not(['localhost', 'intranet.mojolicious.org']);
domains that don't require a proxy server to be used. they get the VIP skip-the-line treatment. it takes an arrayref, so load it up. β¨
π₯ METHODS π₯
Mojo::UserAgent::Proxy inherits all methods from Mojo::Base and implements the following new ones. (free methods from your parent, plus these three baddies.)
π detect
$proxy = $proxy->detect;
checks environment variables HTTP_PROXY, http_proxy, HTTPS_PROXY, https_proxy, NO_PROXY and no_proxy for proxy information. yes β both the uppercase and lowercase versions of each, it's thorough like that. π
automatic proxy detection can be enabled with the MOJO_PROXY environment variable. go off, environment variable. π
β is_needed
my $bool = $proxy->is_needed('intranet.example.com');
checks if a request for a domain would use a proxy server. returns a bool, so you get a tidy little true/false back. vibe check for your domain, basically. π§
πΈ prepare
$proxy->prepare(Mojo::Transaction::HTTP->new);
prepares proxy server information for a transaction. you hand it a Mojo::Transaction::HTTP and it does the prep work so the transaction doesn't have to. teamwork makes the dream work. π«Ά
π SEE ALSO π
MojoliciousMojolicious::Guides- <https://mojolicious.org>
go read those too, iykyk. π
lowkey a public service announcement: this is User Contributed Perl Documentation, so it's the community's finest, not core Perl's. treat it with the respect it deserves (all of it).
alright bestie that's the page π
it's perl v5.42.0, dated 2026-07-15, and this little manual moment was brought to you by the Mojo::U...::Proxy(3) page β truncated name and all. mwah. πβ¨
π¦ where this page comes from
- opensuse-leap 16.0: perl-Mojolicious 9.480.0-bp160.2.1 Β· Artistic-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms