<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Leo Lin on Medium]]></title>
        <description><![CDATA[Stories by Leo Lin on Medium]]></description>
        <link>https://medium.com/@leolin.flaship?source=rss-b4ddfea2fcaa------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*03CNV1mVSgryBNhx</url>
            <title>Stories by Leo Lin on Medium</title>
            <link>https://medium.com/@leolin.flaship?source=rss-b4ddfea2fcaa------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 23:12:39 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@leolin.flaship/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[LuaRocks atrás de um proxy: por que HTTPS_PROXY em maiúsculas é ignorado, o papel do no_proxy e o…]]></title>
            <link>https://medium.com/@leolin.flaship/luarocks-atr%C3%A1s-de-um-proxy-por-que-https-proxy-em-mai%C3%BAsculas-%C3%A9-ignorado-o-papel-do-no-proxy-e-o-1ecedbc463a2?source=rss-b4ddfea2fcaa------2</link>
            <guid isPermaLink="false">https://medium.com/p/1ecedbc463a2</guid>
            <category><![CDATA[luarocks]]></category>
            <category><![CDATA[publish]]></category>
            <category><![CDATA[lua]]></category>
            <category><![CDATA[proxy]]></category>
            <dc:creator><![CDATA[Leo Lin]]></dc:creator>
            <pubDate>Wed, 02 Dec 2026 01:06:39 GMT</pubDate>
            <atom:updated>2026-12-02T01:06:39.076Z</atom:updated>
            <content:encoded><![CDATA[<h3>LuaRocks atrás de um proxy: por que HTTPS_PROXY em maiúsculas é ignorado, o papel do no_proxy e o wget como downloader</h3><p><em>Leo Lin, Product Manager na </em><a href="https://www.flaship.com/"><em>FlashIP</em></a><em> (Singapura). Aviso: eu trabalho na FlashIP, uma empresa que oferece serviços de proxy.</em></p><p>Quem usa Lua em rede corporativa ou em runners de CI que só saem para a internet por um proxy HTTP costuma esbarrar no mesmo problema: luarocks install funciona no notebook, mas no servidor termina com Could not find a result named ..., como se o pacote não existisse. Em geral o pacote existe; o que falhou foi o download do manifest, porque o LuaRocks não usou o proxy configurado.</p><p>A documentação oficial (“LuaRocks through a proxy”) é curta: o LuaRocks acessa a rede por meio de programas auxiliares (wget ou curl) ou dos módulos LuaSocket e LuaSec, e todos são configurados pelas variáveis de ambiente http_proxy, https_proxy e ftp_proxy. O detalhe importante está nos nomes em minúsculas. Testei tudo abaixo em dezembro de 2026, no Debian 13 com LuaRocks 3.8.0 (pacote da distribuição), Lua 5.1.5, LuaSocket 3.1.0, LuaSec 1.3.2, GNU Wget 1.25.0 e curl 8.14.1, usando um tinyproxy local e conferindo o log de acesso para saber se cada requisição passou ou não pelo proxy. Também conferi no código-fonte da versão 3.13.0 (a release mais recente no GitHub) que a lógica descrita aqui continua a mesma. Troque proxy.example.com:3128 pelo endereço do seu proxy.</p><h3>Como o LuaRocks decide quem faz o download</h3><p>Lendo src/luarocks/fs/lua.lua, a função de download segue esta ordem:</p><ol><li>Se a variável no_proxy existir (com qualquer valor), o download é delegado direto ao downloader externo, para que ele cuide da lista de exceções.</li><li>URLs http:// são baixadas pelo LuaSocket, que lê apenas http_proxy (se faltar o esquema, o LuaRocks acrescenta <a href="http://)./">http://).</a></li><li>URLs https:// usam o LuaSec, <strong>exceto</strong> quando https_proxy está definida, porque o LuaSec não suporta proxy. Nesse caso o LuaRocks cai para o downloader externo.</li><li>O downloader externo é escolhido em fs/tools.lua: primeiro wget, depois curl.</li></ol><p>Todas essas checagens usam os.getenv com o nome em minúsculas. Por isso o resultado depende muito de como você escreveu a variável.</p><h3>O que o log do proxy mostrou</h3><p>Comando de teste: luarocks download --rockspec inspect, com HOME limpo a cada execução para evitar o cache.</p><p>Variáveis definidasDownloaderPassou pelo proxy?só HTTPS_PROXY (maiúsculas)LuaSecNão (conexão direta)só https_proxy (minúsculas)wgetSimHTTPS_PROXY + no_proxy=example.internalwgetNãoHTTPS_PROXY + NO_PROXY=example.internalLuaSecNãosó ALL_PROXYLuaSecNãoHTTPS_PROXY + no_proxy, com wget indisponívelcurlSimhttps_proxy + no_proxy=luarocks.orgwgetNão (exceção aplicada)</p><p>A primeira linha é a armadilha: em uma máquina com acesso direto à internet, o comando funciona e você nem percebe que o proxy foi ignorado. Num runner sem saída direta, ele falha. A terceira linha mostra outro detalhe: o wget também só lê https_proxy em minúsculas, enquanto o curl aceita as duas formas.</p><h3>Configuração recomendada</h3><pre>export http_proxy=http://proxy.example.com:3128<br>export https_proxy=http://proxy.example.com:3128<br>export no_proxy=localhost,127.0.0.1,.corp.example.com</pre><pre>luarocks install inspect</pre><p>Com https_proxy definida, o LuaRocks 3.8.0 mostra este aviso:</p><pre>Warning: falling back to wget - install luasec to get native HTTPS support</pre><p>No meu ambiente o LuaSec estava instalado. O aviso só indica que o LuaSec foi pulado por causa do proxy, e o download continua normalmente pelo wget. Não é preciso instalar nada.</p><p>Se o proxy exige autenticação, use o formato http://usuario:senha@proxy.example.com:3128 e aplique percent-encoding a caracteres especiais da senha, como @ e :. Quem lê essa URL é o wget ou o curl, não o LuaRocks.</p><h3>Quando o proxy está errado, a mensagem engana</h3><p>Apontei https_proxy para uma porta fechada e o resultado foi:</p><pre>Warning: Failed searching manifest: Failed downloading https://luarocks.org/manifest-5.1 - failed downloading https://luarocks.org/manifest-5.1<br>Error: Could not find a result named inspect: No results matching query were found for Lua 5.1.</pre><p>Quando o erro diz que o pacote não foi encontrado, leia os avisos acima dele. Se todos forem Failed searching manifest, o problema é de rede ou de proxy, não de nome de pacote. A opção --verbose mostra os comandos executados e --timeout &lt;segundos&gt; ajusta o tempo limite das operações de rede (o padrão é 30, e 0 significa sem limite).</p><h3>Servidores e mirrors</h3><p>O LuaRocks consulta vários servidores em sequência (a lista muda conforme a versão e a distribuição; veja com luarocks config rocks_servers). Em redes que só liberam alguns domínios, é mais previsível fixar um servidor só:</p><pre>luarocks install inspect --only-server=https://luarocks.org</pre><p>--server dá prioridade a um servidor sem descartar os outros, e --only-server ignora o restante da configuração. A opção rocks_servers também pode ser definida no arquivo de configuração (~/.luarocks/config-5.1.lua no meu caso, ou o arquivo indicado em LUAROCKS_CONFIG).</p><h3>Escolhendo wget ou curl</h3><p>A tabela variables do arquivo de configuração aceita as entradas WGET e CURL, segundo a documentação &quot;Config file format&quot;. Como o LuaRocks testa o wget primeiro, uma forma de forçar o curl, que aceita HTTPS_PROXY em maiúsculas, é apontar WGET para um caminho inexistente:</p><pre>-- ~/.luarocks/config-5.1.lua<br>variables = { WGET = &quot;/nonexistent/wget&quot; }</pre><p>Testei e o curl passou a fazer os downloads, mas definir as variáveis em minúsculas continua sendo mais simples.</p><h3>Certificados e git</h3><p>No código das versões 3.8.0 e 3.13.0, check_certificates tem padrão false. Com esse padrão, o LuaRocks passa --no-check-certificate ao wget e -k ao curl. Se você ativar check_certificates = true atrás de um proxy que inspeciona HTTPS, instale a CA corporativa no repositório do sistema (no Debian, em /usr/local/share/ca-certificates/ seguido de update-ca-certificates).</p><p>Rockspecs com fonte git:// são baixados pelo git, que tem configuração de proxy própria. A documentação oficial sugere trocar o protocolo git://, muitas vezes bloqueado por firewalls, por HTTPS:</p><pre>git config --global url.&quot;https://&quot;.insteadOf git://</pre><h3>Resumo</h3><ul><li>Use http_proxy e https_proxy <strong>em minúsculas</strong>. Só HTTPS_PROXY faz o LuaSec conectar direto.</li><li>Definir no_proxy faz o LuaRocks delegar o download ao wget/curl.</li><li>O wget lê apenas as variáveis em minúsculas; o curl aceita as duas formas.</li><li>“Could not find a result” acompanhado de Failed searching manifest aponta para problema de rede, não para o nome do pacote.</li><li>Em redes restritas, --only-server deixa o comportamento previsível.</li></ul><p>Referências: documentação do LuaRocks (luarocks_through_a_proxy.md e config_file_format.md no repositório luarocks/luarocks), luarocks help e o código-fonte de fs/lua.lua, fs/tools.lua e core/cfg.lua (v3.13.0). Se quiser entender melhor os diferentes tipos de proxy, o site da <a href="https://www.flaship.com/">FlashIP</a> tem mais material.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1ecedbc463a2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[プロキシ環境で Perl モジュールを入れる：cpan・cpanm・cpm・Carton の設定]]></title>
            <link>https://medium.com/@leolin.flaship/%E3%83%97%E3%83%AD%E3%82%AD%E3%82%B7%E7%92%B0%E5%A2%83%E3%81%A7-perl-%E3%83%A2%E3%82%B8%E3%83%A5%E3%83%BC%E3%83%AB%E3%82%92%E5%85%A5%E3%82%8C%E3%82%8B-cpan-cpanm-cpm-carton-%E3%81%AE%E8%A8%AD%E5%AE%9A-1ab2fd1a2a8b?source=rss-b4ddfea2fcaa------2</link>
            <guid isPermaLink="false">https://medium.com/p/1ab2fd1a2a8b</guid>
            <dc:creator><![CDATA[Leo Lin]]></dc:creator>
            <pubDate>Tue, 01 Dec 2026 22:54:41 GMT</pubDate>
            <atom:updated>2026-12-01T22:54:41.581Z</atom:updated>
            <content:encoded><![CDATA[<p><em>リオ・リン（Leo Lin）／</em><a href="https://www.flaship.com/"><em>FlashIP</em></a><em> プロダクトマネージャー（シンガポール）。開示：筆者はプロキシサービスを提供する FlashIP に勤務しています。</em></p><p>社内ネットワークや CI のコンテナで Perl のモジュールを入れようとすると、「cpan で設定したはずのプロキシが使われていない」「HTTPS_PROXY を設定したのに cpanm だけ直接つなぎに行く」といった現象に出会うことがあります。原因の多くは Perl 側ではなく、実際にファイルを取ってくるプログラムにあります。CPAN のクライアントは自分で HTTP を話すとは限らず、環境に応じて wget、curl、LWP、HTTP::Tiny のどれかに処理を任せるため、どの設定が読まれるかもそれによって変わるのです。</p><p>本記事では、Debian 上の Perl 5.40.1 に同梱された CPAN.pm 2.36、cpanm 1.7049、cpm v1.1.7、Carton v1.0.35（GNU Wget 1.25.0、curl 8.14.1）を使い、ローカルに立てた検証用プロキシでアクセスログを見ながら挙動を確認しました（2026年12月2日）。CPAN.pm については、執筆時点の最新版 2.41 のソースでも該当箇所が同じであることを確認しています。例として、社内プロキシを proxy.example.co.jp:8080 とします。</p><h3>1. まず「誰がダウンロードしているか」を確認する</h3><p>各ツールのダウンロード方式は次のとおりです。</p><ul><li><strong>cpan（CPAN.pm）</strong>：Net::SSLeay と IO::Socket::SSL が使えれば HTTP::Tiny で取得し、なければ設定済みの外部コマンド（curl、次に wget）を呼びます。</li><li><strong>cpanm</strong>：LWP、wget、curl、HTTP::Tiny の順に、最初に見つかったものを使います（公式ドキュメントに記載）。--no-lwp、--no-wget、--no-curl で候補から外せます。</li><li><strong>cpm</strong>：HTTP::Tinyish 経由で利用可能なバックエンドを選びます。検証環境では curl が使われました。</li><li><strong>Carton</strong>：内部で cpanm を呼び出すので、cpanm と同じ規則に従います。</li></ul><p>cpanm -v（--verbose）を付けると冒頭に You have /usr/bin/wget のように使用するツールが表示されるので、トラブル時はまずここを見てください。</p><h3>2. cpan（CPAN.pm）：o conf の設定と https_proxy の罠</h3><p>CPAN.pm のプロキシ設定は、cpan シェルの o conf で行います。</p><pre>$ cpan<br>cpan[1]&gt; o conf http_proxy http://proxy.example.co.jp:8080<br>cpan[2]&gt; o conf no_proxy localhost,.example.co.jp<br>cpan[3]&gt; o conf proxy_user myuser<br>cpan[4]&gt; o conf commit</pre><p>o conf init /proxy/ と打てば、プロキシ関連の項目だけを対話的に設定し直すこともできます。設定は ~/.cpan/CPAN/MyConfig.pm に保存され、初回設定時の説明文にあるとおり、環境変数より設定ファイルの値が優先されます。また、初回の自動設定ではその時点の環境変数 http_proxy の値が既定値として取り込まれ、ファイルに保存されます。一時的に設定した環境変数が残り続けて「プロキシを外したのにまだ経由している」となるのはこのためで、その場合は o conf http_proxy &quot;&quot; で消してから o conf commit します。</p><p>ここで注意したいのが、CPAN.pm の設定項目には ftp_proxy、http_proxy、no_proxy はあっても https_proxy がない点です。現在の既定のダウンロード先は https://cpan.org/ ですが、o conf http_proxy の値がどう使われるかはダウンロード方式によって異なります。</p><ul><li><strong>HTTP::Tiny の場合</strong>：http_proxy の値が HTTP と HTTPS 共通のプロキシとして渡されるので、HTTPS もプロキシ経由になります。</li><li><strong>curl の場合</strong>：CPAN.pm が -x &quot;http://proxy.example.co.jp:8080&quot; と -U &quot;ユーザー:パスワード&quot; をコマンドラインに付けて実行するため、設定ファイルだけで動きます。</li><li><strong>wget の場合</strong>：プロキシ関連の引数は付きません。wget は自分で環境変数を読むので、https_proxy が export されていなければ HTTPS は直接接続になります。</li></ul><p>実際に、wget だけが設定された環境で o conf http_proxy のみを設定して実行すると、検証用プロキシには一件も接続が来ず、wget は cpan.org に直接つないでいました。同じ設定で環境変数 https_proxy を export すると、すべての取得がプロキシ経由になりました。どの方式が使われるか分からない環境では、設定ファイルと環境変数の両方を設定しておくのが確実です。</p><pre>export http_proxy=http://proxy.example.co.jp:8080<br>export https_proxy=http://proxy.example.co.jp:8080<br>export no_proxy=localhost,.example.co.jp<br>cpan Try::Tiny</pre><p>もう一つ、curl または wget で取得するときに proxy_user が空だと、認証のないプロキシでも Proxy authentication needed! と表示されてユーザー名を尋ねられます。認証が不要なら Enter で進めて問題ありません。CI など対話できない環境では、プロンプトで止まらないように注意してください。なお、proxy_pass を保存すると MyConfig.pm に平文で書き込まれ、curl を使う場合はコマンドラインにも現れるため、他人と共有するマシンでは避けたほうがよいでしょう。</p><h3>3. cpanm：既定の取得先が HTTP であることに注意</h3><p>cpanm 1.7049 の既定の取得先は、モジュール検索に使う CPAN Meta DB（http://cpanmetadb.plackperl.org/v1.0/）も、ミラー（http://www.cpan.org）も、平文の HTTP です。そのため、https_proxy だけを設定していると、通信が http_proxy 側の設定（未設定なら直接接続）で行われます。平文の HTTP を通さないプロキシの配下では、取得先を HTTPS のミラーに固定するのが簡単です。</p><pre>export https_proxy=http://proxy.example.co.jp:8080<br>cpanm --from https://cpan.metacpan.org/ Try::Tiny</pre><pre># 毎回付けるのが面倒なら PERL_CPANM_OPT に入れる<br>export PERL_CPANM_OPT=&quot;--from https://cpan.metacpan.org/&quot;</pre><p>--from（-M）は指定したミラーとそのインデックス「だけ」を使うオプションで、Meta DB への問い合わせも行いません。検証では、このオプションを付けると通信が cpan.metacpan.org:443 への CONNECT だけになりました。</p><p>環境変数の大文字・小文字にも気をつける必要があります。wget は小文字の https_proxy を読みますが、大文字の HTTPS_PROXY だけを設定した状態では、プロキシを使わず直接接続しました。一方、--no-wget で curl を使わせると大文字の HTTPS_PROXY も読まれました。CI ランナーなどで大文字の変数しか設定されていない場合は、小文字の変数も同じ値で設定しておきましょう。no_proxy はドメインの末尾一致で、no_proxy=metacpan.org とすると cpan.metacpan.org は直接接続になりました。</p><p>認証付きプロキシは、URL にユーザー名とパスワードを含めます。パスワードに @ や : が含まれる場合は、パーセントエンコードが必要です。</p><pre>export https_proxy=http://myuser:mypass@proxy.example.co.jp:8080</pre><p>資格情報が間違っていると、wget 経由では Proxy tunneling failed: Proxy Authentication Required と表示され、続いて Couldn&#39;t find module or a distribution で終了します。後者だけを見るとモジュール名の誤りに見えるので、-v で直前の行まで確認してください。</p><h3>SOCKS5 しかない場合</h3><p>wget は SOCKS に対応していないため、https_proxy=socks5h://... を設定すると Error parsing proxy URL socks5h://127.0.0.1:1080: Unsupported scheme. で失敗します。curl は環境変数でも socks5h:// を解釈するので、wget を外せば SOCKS5 経由で動きます。socks5h は名前解決もプロキシ側で行わせる指定です。</p><pre>export https_proxy=socks5h://127.0.0.1:1080<br>cpanm --no-wget --from https://cpan.metacpan.org/ Try::Tiny</pre><h3>4. cpm と Carton</h3><p>cpm v1.1.7 は、Meta DB（cpanmetadb.plackperl.org）にもミラー（cpan.metacpan.org）にも最初から HTTPS で接続するので、https_proxy を設定するだけで済みました。検証環境では curl が使われ、https_proxy と HTTPS_PROXY のどちらでもプロキシを経由しました。</p><pre>export https_proxy=http://proxy.example.co.jp:8080<br>cpm install -L local Try::Tiny</pre><p>Carton（carton install）は内部で cpanm を呼ぶため、環境変数の扱いは第 3 節と同じです。ただし Carton v1.0.35 の既定ミラーは http://cpan.metacpan.org/ なので、HTTPS で取得したい場合は環境変数 PERL_CARTON_MIRROR で指定します。</p><pre>export https_proxy=http://proxy.example.co.jp:8080<br>export PERL_CARTON_MIRROR=https://cpan.metacpan.org/<br>carton install</pre><h3>5. TLS 検査を行うプロキシと CA 証明書</h3><p>HTTPS の中身を復号して検査するプロキシの配下では、証明書の検証エラーが出ます。プロキシの設定ではなく、社内のルート CA を信頼していないことが原因です。wget と curl は OS の証明書ストアを使うので、Debian や Ubuntu なら CA 証明書を /usr/local/share/ca-certificates/ に .crt の拡張子で置き、update-ca-certificates を実行します。</p><pre>sudo cp corp-root-ca.crt /usr/local/share/ca-certificates/<br>sudo update-ca-certificates</pre><p>HTTP::Tiny を使う場合は少し事情が違います。Perl 5.40 同梱の HTTP::Tiny 0.088 は、環境変数 SSL_CERT_FILE が設定されていればそのファイルを使い、なければ Mozilla::CA モジュール、それもなければ OS の証明書バンドルの順に探します。Mozilla::CA が入っていると OS に追加した CA が使われないので、その場合は SSL_CERT_FILE で社内 CA を含むバンドルを指定してください。</p><h3>6. CI での設定例</h3><p>Dockerfile や CI のジョブでは、方式に依存しないよう小文字と大文字の両方を設定し、取得先を HTTPS に固定しておくと安定します。</p><pre>export http_proxy=http://proxy.example.co.jp:8080<br>export https_proxy=$http_proxy HTTP_PROXY=$http_proxy HTTPS_PROXY=$http_proxy<br>export no_proxy=localhost,.example.co.jp NO_PROXY=$no_proxy<br>export PERL_CPANM_OPT=&quot;--from https://cpan.metacpan.org/&quot;<br>cpanm --notest --installdeps .</pre><h3>7. トラブルシューティング</h3><ul><li><strong>cpan で設定したのにプロキシを経由しない</strong>：ダウンロード方式が wget ではないか確認し、https_proxy を export します。o conf wget と o conf curl で設定値を確認できます。</li><li><strong>プロキシを外したのにまだ経由している</strong>：~/.cpan/CPAN/MyConfig.pm の http_proxy が残っています。o conf http_proxy &quot;&quot; と o conf commit を実行します。</li><li><strong>cpanm が </strong><strong>Couldn&#39;t find module or a distribution で終わる</strong>：-v で直前のエラーを確認します。HTTP を通さないプロキシ、407、大文字の変数しかない、のいずれかであることが多いです。</li><li><strong>CI で cpan が止まる</strong>：proxy_user が空のため、ユーザー名の入力待ちになっている可能性があります。</li><li><strong>証明書エラー</strong>：第 5 節のとおり、使われている方式に合わせて CA を登録します。</li></ul><h3>まとめ</h3><p>Perl のモジュール導入でプロキシが効かないときは、まず「実際にダウンロードしているのは wget、curl、HTTP::Tiny のどれか」を確認してください。cpan は設定ファイルの http_proxy に加えて環境変数の https_proxy、cpanm と Carton は小文字の環境変数と HTTPS のミラー指定、cpm は https_proxy だけ。この違いを押さえておけば、ほとんどのケースは切り分けられます。</p><p><a href="https://www.flaship.com/">FlashIP</a> では、開発環境や CI で HTTP／SOCKS5 プロキシを使うチームとやり取りすることがありますが、こうしたトラブルの多くはプロキシ側ではなく、クライアントがどの設定を読んでいるかの問題です。まずはツールの詳細ログで実際の接続先を確認するところから始めてみてください。</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1ab2fd1a2a8b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[プロキシ環境で Android 開発環境を動かす：sdkmanager・Android Studio・Gradle の設定と社内 CA 証明書の登録]]></title>
            <link>https://medium.com/@leolin.flaship/%E3%83%97%E3%83%AD%E3%82%AD%E3%82%B7%E7%92%B0%E5%A2%83%E3%81%A7-android-%E9%96%8B%E7%99%BA%E7%92%B0%E5%A2%83%E3%82%92%E5%8B%95%E3%81%8B%E3%81%99-sdkmanager-android-studio-gradle-%E3%81%AE%E8%A8%AD%E5%AE%9A%E3%81%A8%E7%A4%BE%E5%86%85-ca-%E8%A8%BC%E6%98%8E%E6%9B%B8%E3%81%AE%E7%99%BB%E9%8C%B2-c6dffa11436b?source=rss-b4ddfea2fcaa------2</link>
            <guid isPermaLink="false">https://medium.com/p/c6dffa11436b</guid>
            <dc:creator><![CDATA[Leo Lin]]></dc:creator>
            <pubDate>Tue, 01 Dec 2026 21:57:23 GMT</pubDate>
            <atom:updated>2026-12-01T21:57:23.807Z</atom:updated>
            <content:encoded><![CDATA[<p>プロキシ環境で Android 開発環境を動かす：sdkmanager・Android Studio・Gradle の設定と社内 CA 証明書の登録</p><p>社内ネットワークや CI サーバーで Android のビルド環境を用意すると、「Android Studio の SDK Manager は動くのに、ターミナルの sdkmanager はタイムアウトする」「IDE では同期できるのに、CI の ./gradlew だけ依存関係を取得できない」といった状況によく出会います。原因はたいてい単純で、sdkmanager、Android Studio 本体、Gradle（とその JVM）がそれぞれ別の場所からプロキシ設定を読んでいるからです。本記事では、Android Developers の公式ドキュメント（sdkmanager、Configure Android Studio）と Gradle User Manual の Networking / Build Environment の章、そして Android SDK Command-line Tools 22.0 の実際の挙動をもとに、設定箇所を一つずつ整理します（2026年12月2日確認）。例として、社内プロキシを proxy.example.co.jp:8080 とします。</p><h3>1. sdkmanager：3 つのオプションはセットで指定する</h3><p>公式ドキュメントに載っているプロキシ関連オプションは次の 4 つです。</p><ul><li>--proxy={http | socks}：プロキシの種類。http は HTTP/FTP などの上位プロトコル用、socks は SOCKS（v4/v5）用</li><li>--proxy_host=：プロキシの IP アドレスまたはホスト名</li><li>--proxy_port=：ポート番号</li><li>--no_https：すべての接続を HTTPS ではなく HTTP で行う</li></ul><pre>sdkmanager --list --proxy=http --proxy_host=proxy.example.co.jp --proxy_port=8080<br>sdkmanager &quot;platform-tools&quot; &quot;platforms;android-36&quot; \<br>  --proxy=socks --proxy_host=10.0.0.5 --proxy_port=1080</pre><p>注意したいのは、--proxy、--proxy_host、--proxy_port のどれか一つだけを指定するとエラーになる点です。実際に --proxy=http だけを付けて実行すると、All of --proxy_host=, --proxy_port=, and --proxy= must be specified if any are. と表示されて終了します。また、ユーザー名やパスワードを渡すオプションはありません。認証付きプロキシしかない環境では、認証を肩代わりするローカルの中継プロキシ（cntlm など）を立て、sdkmanager にはそちらを指定するのが現実的です。</p><p>--no_https は「プロキシを使う」という意味ではなく、通信を平文の HTTP に切り替えるオプションです。TLS を通さないプロキシしかない古い環境向けの回避策なので、改ざん検知の観点からも常用は避け、まずは後述する CA 証明書の登録で解決することをおすすめします。</p><h3>環境変数 HTTPS_PROXY も読まれる</h3><p>公式ページには書かれていませんが、cmdline-tools 22.0 の sdkmanager は、--proxy_host が指定されていない場合に環境変数 HTTPS_PROXY（未設定なら HTTP_PROXY）を読みます。--no_https 付きのときは HTTP_PROXY だけを見ます。筆者が確認した範囲では、次の点に気をつける必要があります。</p><ul><li>読まれるのは大文字の変数名だけで、NO_PROXY による除外は行われません。</li><li>URL のスキームは http:// または https:// にしてください。socks5://127.0.0.1:1080 を設定すると unknown protocol: socks5 で起動直後に失敗します。SOCKS を使いたい場合は --proxy=socks を明示します。</li><li>シェルに不要な HTTPS_PROXY が残っていて直接つなぎたいときは、ヘルプに載っていない --no_proxy オプションで環境変数を無視できます（22.0 で確認）。</li></ul><p>なお、公式ドキュメントでは sdkmanager は非推奨となり、Android CLI の android sdk コマンドへの移行が案内されています。既存の CI スクリプトはしばらく sdkmanager のまま動きますが、新規に組む場合は移行先のドキュメントもあわせて確認してください。</p><h3>2. Android Studio：HTTP Proxy 設定画面</h3><p>IDE 本体（SDK Manager、プラグイン、アップデート確認など）のプロキシは、<strong>File &gt; Settings</strong>（macOS では <strong>Android Studio &gt; Settings</strong>）の <strong>Appearance &amp; Behavior &gt; System Settings &gt; HTTP Proxy</strong> で設定します。PAC ファイルを使う社内なら「Auto-detect proxy settings」、そうでなければ「Manual proxy configuration」で HTTP か SOCKS を選び、ホスト、ポート、除外ホスト（No proxy for）、必要なら認証情報を入力します。「Check connection」で疎通確認ができるので、ここで https://dl.google.com などを試しておくと切り分けが楽になります。</p><p>公式ドキュメントには「Android Studio を使っている場合、HTTP Proxy 画面の設定が gradle.properties のプロキシ設定より優先される」と明記されています。言い換えると、IDE 上でビルドが通っていても、同じ設定がコマンドラインの Gradle に引き継がれているとは限りません。IDE から Gradle 用の設定を gradle.properties に書き込むよう提案されることもありますが、CI では次の節の設定を明示的に用意しておくのが確実です。</p><h3>3. Gradle：gradle.properties の systemProp</h3><p>Gradle は環境変数 HTTP_PROXY を読みません。プロキシは JVM の標準システムプロパティで指定し、gradle.properties に systemProp. を付けて書きます。</p><pre>systemProp.http.proxyHost=proxy.example.co.jp<br>systemProp.http.proxyPort=8080<br>systemProp.https.proxyHost=proxy.example.co.jp<br>systemProp.https.proxyPort=8080<br># https 用の nonProxyHosts は存在しない（http 側が両方に効く）<br>systemProp.http.nonProxyHosts=localhost|127.0.0.1|*.example.co.jp<br># 認証が必要な場合<br>#systemProp.https.proxyUser=userid<br>#systemProp.https.proxyPassword=password<br>#systemProp.http.auth.ntlm.domain=DOMAIN</pre><p>ポイントは三つあります。第一に、HTTP と HTTPS は別設定です。Maven Central や Google Maven リポジトリは HTTPS なので、https.* を忘れると依存関係の取得だけが失敗します。第二に、除外リストは http.nonProxyHosts だけで、| 区切り、先頭か末尾に * が使えます。Gradle のドキュメントでも、HTTPS の例に http.nonProxyHosts を書いたうえで「タイポではない」と注記しています。第三に、SOCKS の場合は systemProp.socksProxyHost と systemProp.socksProxyPort を使います。</p><p>ファイルの置き場所にも優先順位があります。Gradle はユーザーディレクトリ（GRADLE_USER_HOME、通常は ~/.gradle）の gradle.properties を最優先し、次にプロジェクトルート、最後に Gradle 本体のディレクトリを参照します。パスワードをリポジトリにコミットしないためにも、認証情報は ~/.gradle/gradle.properties に置きましょう。Gradle Wrapper のディストリビューションのダウンロードも同じ設定でプロキシを通ります（gradle-wrapper.properties には書きません）。設定を変えた後は、古いデーモンが残らないよう ./gradlew --stop を実行してから再ビルドすると確実です。</p><h3>4. 社内 CA 証明書を JDK の cacerts に登録する</h3><p>TLS を復号して検査するプロキシの配下では、Gradle や sdkmanager が PKIX path building failed や unable to find valid certification path to requested target で失敗します。これはプロキシの設定ミスではなく、JDK が社内のルート CA を信頼していないことが原因です。JDK 9 以降の keytool なら -cacerts で既定のトラストストアを直接指定できます。</p><pre># Gradle / sdkmanager を動かしている JDK の keytool を使う<br>&quot;$JAVA_HOME/bin/keytool&quot; -importcert -cacerts \<br>  -alias example-corp-root -file corp-root-ca.pem \<br>  -storepass changeit -noprompt<br>&quot;$JAVA_HOME/bin/keytool&quot; -list -cacerts -alias example-corp-root -storepass changeit</pre><p>changeit は cacerts の既定パスワードです。よくある失敗は、登録した JDK と実際にビルドで使われている JDK が違うケースです。Android Studio のビルドは、<strong>Settings &gt; Build, Execution, Deployment &gt; Build Tools &gt; Gradle</strong> の「Gradle JDK」で選ばれた JDK（同梱の JetBrains Runtime であることが多い）で動きます。同梱 JDK は Android Studio の更新で入れ替わり、登録した証明書が消えることがあるため、別の場所にトラストストアを用意して systemProp.javax.net.ssl.trustStore と systemProp.javax.net.ssl.trustStorePassword で指定する方法も検討してください。</p><h3>5. CI での設定例</h3><p>CI ランナーには HTTPS_PROXY が設定済みのことが多いものの、前述のとおり Gradle はそれを読みません。ジョブの最初で Gradle 用の設定を生成しておくと、どの CI でも同じ形で使えます。</p><pre>mkdir -p &quot;${GRADLE_USER_HOME:-$HOME/.gradle}&quot;<br>cat &gt;&gt; &quot;${GRADLE_USER_HOME:-$HOME/.gradle}/gradle.properties&quot; &lt;&lt;PROPS<br>systemProp.http.proxyHost=proxy.example.co.jp<br>systemProp.http.proxyPort=8080<br>systemProp.https.proxyHost=proxy.example.co.jp<br>systemProp.https.proxyPort=8080<br>systemProp.http.nonProxyHosts=localhost|*.example.co.jp<br>PROPS</pre><pre>export HTTPS_PROXY=http://proxy.example.co.jp:8080   # sdkmanager 用<br>yes | sdkmanager --licenses<br>sdkmanager &quot;platform-tools&quot; &quot;build-tools;36.0.0&quot;<br>./gradlew assembleDebug</pre><p>単発で試すだけなら、./gradlew -Dhttps.proxyHost=proxy.example.co.jp -Dhttps.proxyPort=8080 assembleDebug のようにコマンドラインで渡すこともできます。コマンドラインの指定は gradle.properties より優先されます。sdkmanager の起動スクリプトは JAVA_OPTS と SDKMANAGER_OPTS を JVM オプションとして渡すので、別のトラストストアを使う場合は SDKMANAGER_OPTS=&quot;-Djavax.net.ssl.trustStore=/path/to/truststore.jks&quot; のように指定できます。</p><h3>6. トラブルシューティング</h3><ul><li><strong>sdkmanager が </strong><strong>Warning: IO exception while downloading manifest を繰り返す</strong>：プロキシに届いていないか、プロキシ側で拒否されています。--verbose を付け、HTTPS_PROXY の値と 3 つのオプションの組み合わせを確認します。</li><li><strong>Gradle が </strong><strong>Connect timed out で止まる</strong>：https.proxyHost の書き漏れ、または ~/.gradle/gradle.properties に残った古い設定が優先されている可能性があります。./gradlew --info で接続先を確認しましょう。</li><li><strong>407 Proxy Authentication Required</strong>：proxyUser／proxyPassword を http.* と https.* の両方に設定しているか確認します。NTLM の場合は http.auth.ntlm.domain も必要です。</li><li><strong>PKIX path building failed</strong>：第 4 節のとおり、ビルドで実際に使っている JDK に社内 CA を登録します。</li><li><strong>社内の Nexus や Artifactory までプロキシ経由になる</strong>：http.nonProxyHosts に社内ドメインを追加します。</li></ul><h3>まとめ</h3><p>sdkmanager はコマンドラインオプションか大文字の HTTPS_PROXY、Android Studio は HTTP Proxy 画面、Gradle は gradle.properties の systemProp、TLS 検査への対応は JDK のトラストストア。この 4 か所を分けて考えれば、プロキシ配下の Android ビルドで迷うことはほとんどなくなります。</p><p><a href="https://www.flaship.com/">FlashIP</a> では、CI やテスト環境で HTTP／SOCKS5 プロキシを使うチームと日々やり取りしていますが、トラブルの多くは「どのプロセスがどの設定を読むか」を確かめるだけで解決します。プロキシ自体を疑う前に、まずはこの切り分けから始めてみてください。</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c6dffa11436b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Homebrew atrás de proxy: variáveis de ambiente, brew.env,]]></title>
            <link>https://medium.com/@leolin.flaship/homebrew-atr%C3%A1s-de-proxy-vari%C3%A1veis-de-ambiente-brew-env-d294ecee5244?source=rss-b4ddfea2fcaa------2</link>
            <guid isPermaLink="false">https://medium.com/p/d294ecee5244</guid>
            <category><![CDATA[homebrew]]></category>
            <category><![CDATA[macos]]></category>
            <dc:creator><![CDATA[Leo Lin]]></dc:creator>
            <pubDate>Mon, 30 Nov 2026 11:07:37 GMT</pubDate>
            <atom:updated>2026-11-30T11:07:37.966Z</atom:updated>
            <content:encoded><![CDATA[<h3>Homebrew atrás de proxy: variáveis de ambiente, brew.env, .curlrc e os detalhes que fazem o brew ignorar sua configuração</h3><p>Por Leo Lin, Product Manager na <a href="https://www.flaship.com/">FlashIP</a>, Singapura. Aviso: eu trabalho na FlashIP, uma empresa que fornece serviços de proxy.</p><p>Quem usa Mac (ou Linux) em rede corporativa conhece a cena: o curl no terminal funciona, o navegador funciona, mas brew install fica parado em Downloading https://ghcr.io/... até dar timeout. Na maioria das vezes o culpado é a forma como o Homebrew monta o ambiente antes de chamar curl e git: ele não repassa tudo o que está no seu shell, ignora o seu ~/.curlrc por padrão e tem um arquivo de configuração próprio com regras bem específicas.</p><p>Neste artigo junto o que a documentação oficial (a manpage do brew, em docs.brew.sh) e o próprio código-fonte do Homebrew dizem sobre isso, com base na versão 7.0.x. Os endereços nos exemplos são fictícios: troque proxy.example.com:3128 pelo seu proxy.</p><h3>1. O básico: variáveis de ambiente em minúsculas</h3><p>A seção “Using Homebrew behind a proxy” da manpage é curta: defina http_proxy, https_proxy, all_proxy, ftp_proxy e/ou no_proxy. Segundo a documentação, essas variáveis valem para o curl, o git e o svn que o Homebrew executa.</p><pre>export http_proxy=http://proxy.example.com:3128<br>export https_proxy=http://proxy.example.com:3128<br>export no_proxy=localhost,127.0.0.1,.intranet.example.com<br>brew update</pre><p>Para um proxy SOCKS5, a manpage usa all_proxy:</p><pre>export all_proxy=socks5://proxy.example.com:1080</pre><p>Se você quiser que a resolução de DNS também aconteça no proxy, o curl aceita o esquema socks5h://. Isso é comportamento do curl (e do git, que usa libcurl), não algo específico do Homebrew.</p><p>Proxy com autenticação segue o formato padrão de URL:</p><pre>export https_proxy=http://usuario:senha@proxy.example.com:3128</pre><p>Se a senha tiver caracteres como @, : ou #, codifique em URL (@ vira %40, : vira %3A). O curl decodifica antes de enviar ao proxy.</p><h3>2. Por que HTTP_PROXY e NO_PROXY em maiúsculas não funcionam</h3><p>Esse é o ponto que mais confunde. O script bin/brew não repassa o seu ambiente inteiro: ele executa o restante do Homebrew com env -i, ou seja, com um ambiente limpo, e copia só uma lista fixa de variáveis. A lista de proxy no código é esta:</p><pre>http_proxy https_proxy ftp_proxy no_proxy all_proxy HTTPS_PROXY FTP_PROXY ALL_PROXY</pre><p>Repare no que falta: HTTP_PROXY e NO_PROXY em maiúsculas. Como muitas ferramentas aceitam as duas formas, é comum ter só as maiúsculas no .zshrc. Para o Homebrew, o HTTP_PROXY some antes mesmo de chegar ao curl (que, aliás, também só lê http_proxy em minúsculas), e a lista de exceções em NO_PROXY é descartada.</p><p>A regra prática: para o Homebrew, use sempre as versões em minúsculas. Se outras ferramentas precisarem das maiúsculas, defina as duas:</p><pre>export http_proxy=http://proxy.example.com:3128<br>export https_proxy=$http_proxy<br>export no_proxy=localhost,127.0.0.1,.intranet.example.com<br>export HTTP_PROXY=$http_proxy HTTPS_PROXY=$https_proxy NO_PROXY=$no_proxy</pre><h3>3. Configuração permanente com brew.env</h3><p>Variáveis exportadas no shell não ajudam em scripts agendados ou execuções que não carregam o perfil do shell. Para isso o Homebrew lê arquivos de ambiente próprios, nesta ordem:</p><ol><li>/etc/homebrew/brew.env (sistema todo)</li><li>${HOMEBREW_PREFIX}/etc/homebrew/brew.env (por prefixo, por exemplo /opt/homebrew no Apple Silicon)</li><li>$XDG_CONFIG_HOME/homebrew/brew.env, se XDG_CONFIG_HOME estiver definido; caso contrário, ~/.homebrew/brew.env (por usuário)</li></ol><p>O arquivo do usuário tem prioridade sobre o do prefixo, que tem prioridade sobre o do sistema. A exceção é quando HOMEBREW_SYSTEM_ENV_TAKES_PRIORITY está definido no arquivo do sistema: aí ele é carregado de novo no final e sobrescreve os demais, o que é útil para administradores que querem impor um proxy.</p><p>A manpage fala em variáveis HOMEBREW_*, mas o código do bin/brew (desde a versão 5.0.0) também aceita nesses arquivos as variáveis de proxy em minúsculas: http_proxy, https_proxy, ftp_proxy, all_proxy e no_proxy. Um exemplo de ~/.homebrew/brew.env:</p><pre>http_proxy=http://proxy.example.com:3128<br>https_proxy=http://proxy.example.com:3128<br>no_proxy=localhost,127.0.0.1,.intranet.example.com</pre><p>Três cuidados com esse formato, todos vindos de como o arquivo é lido:</p><ul><li><strong>Sem </strong><strong>export.</strong> Só são aceitas linhas que começam com o nome da variável. Uma linha export http_proxy=... é ignorada sem aviso.</li><li><strong>Sem aspas.</strong> O valor é usado literalmente; aspas passam a fazer parte da URL.</li><li><strong>Sem expansão.</strong> A documentação avisa que não há expansão de variáveis ($HOME) nem execução de comandos ($(cat arquivo)). Por isso também não dá para buscar a senha em outro lugar: se o proxy exige senha, ela fica em texto puro no arquivo. Ajuste as permissões (chmod 600) ou prefira um proxy que autorize por endereço IP.</li></ul><p>Isso também importa para os comandos brew as-brew-user e brew as-console-user, pensados para scripts administrativos: segundo a manpage, eles rodam com o home do usuário-alvo, em um ambiente limpo, e carregam o brew.env dessa conta. O proxy exportado no shell de quem chama não chega lá; o que está no brew.env chega.</p><h3>4. O ~/.curlrc é ignorado por padrão</h3><p>Se você configurou o proxy em ~/.curlrc (proxy = ...) e o curl do terminal funciona, o Homebrew mesmo assim não vai usar. Ele chama o curl com --disable como primeiro argumento, justamente para não carregar o .curlrc.</p><p>A variável HOMEBREW_CURLRC muda isso:</p><ul><li>Com um caminho absoluto (começando com /), o Homebrew passa esse arquivo com --config, e só ele é carregado.</li><li>Com qualquer outro valor (por exemplo 1), o Homebrew deixa de passar --disable, e o curl volta a ler o .curlrc padrão.</li></ul><pre>export HOMEBREW_CURLRC=/Users/voce/.config/homebrew/curlrc</pre><p>Um detalhe que a documentação destaca: operações de Git, incluindo o brew update de repositórios, não usam esse arquivo, porque o Git tem transporte e configuração próprios. Se você usa taps de terceiros ou HOMEBREW_NO_INSTALL_FROM_API, o Git precisa do proxy por conta própria: via http_proxy/https_proxy (que o Homebrew repassa) ou via http.proxy no ~/.gitconfig.</p><h3>5. Quais domínios liberar e como usar um espelho interno</h3><p>Desde que o Homebrew passou a instalar a partir da API JSON, uma instalação comum fala com poucos destinos. Pelos valores padrão da manpage: os metadados vêm de https://formulae.brew.sh/api (HOMEBREW_API_DOMAIN), os bottles vêm de https://ghcr.io/v2/homebrew/core (HOMEBREW_BOTTLE_DOMAIN), e os repositórios Git ficam em github.com (HOMEBREW_BREW_GIT_REMOTE, HOMEBREW_CORE_GIT_REMOTE). Casks e fórmulas compiladas do código-fonte baixam dos sites dos próprios fornecedores, então a lista real depende do que a equipe instala.</p><p>Em empresas que não querem cada máquina saindo para a internet, a alternativa ao proxy é um espelho:</p><ul><li>HOMEBREW_ARTIFACT_DOMAIN prefixa todas as URLs de download. Uma fórmula com URL https://example.com/foo.tar.gz passa a ser baixada de http://localhost:8080/https://example.com/foo.tar.gz; nos bottles, o domínio é substituído.</li><li>Com HOMEBREW_ARTIFACT_DOMAIN_NO_FALLBACK também definido, o Homebrew dá erro em vez de tentar a URL original quando o espelho falha.</li><li>Se o espelho for um registry OCI que exige autenticação, use HOMEBREW_DOCKER_REGISTRY_TOKEN (bearer) ou HOMEBREW_DOCKER_REGISTRY_BASIC_AUTH_TOKEN (usuário e senha em base64).</li></ul><h3>6. Certificados de proxy corporativo e diagnóstico</h3><p>Proxies que inspecionam TLS apresentam um certificado da própria empresa. A manpage oferece HOMEBREW_FORCE_BREWED_CA_CERTIFICATES, que faz o Homebrew usar o pacote ca-certificates instalado pelo brew em vez do do sistema, e HOMEBREW_FORCE_BREWED_CURL, para preferir o curl do Homebrew. Seja qual for o caminho, a correção certa é fazer a CA da empresa ser confiável, não desligar a verificação de TLS.</p><p>Para descobrir onde a coisa trava:</p><pre>HOMEBREW_CURL_VERBOSE=1 brew fetch --force wget<br>brew config</pre><p>Com HOMEBREW_CURL_VERBOSE, o Homebrew passa --verbose ao curl, e dá para ver se a conexão vai para o proxy (CONNECT ghcr.io:443) ou direto para o destino. O brew config mostra a configuração do Homebrew e do sistema.</p><h3>Resumo</h3><ul><li>Use http_proxy, https_proxy e no_proxy em minúsculas. HTTP_PROXY e NO_PROXY em maiúsculas não passam pelo filtro do bin/brew.</li><li>Para configuração permanente, use brew.env: linhas NOME=valor, sem export, sem aspas, sem expansão.</li><li>~/.curlrc é ignorado, a menos que HOMEBREW_CURLRC esteja definido. O Git não usa esse arquivo.</li><li>Libere formulae.brew.sh, ghcr.io e github.com, ou use HOMEBREW_ARTIFACT_DOMAIN com um espelho interno.</li><li>Diagnostique com HOMEBREW_CURL_VERBOSE=1.</li></ul><p>Uma última observação prática: evite deixar senha de proxy em texto puro em arquivos como brew.env. Se o seu provedor (eu trabalho na <a href="https://www.flaship.com/">FlashIP</a>) aceita autorização por IP, uma máquina ou runner com IP fixo pode dispensar a senha na configuração. Vale confirmar isso diretamente com o provedor.</p><p>Por Leo Lin, Product Manager na <a href="https://www.flaship.com/">FlashIP</a>, Singapura. Aviso: eu trabalho na FlashIP, uma empresa que fornece serviços de proxy.</p><p>Quem usa Mac (ou Linux) em rede corporativa conhece a cena: o curl no terminal funciona, o navegador funciona, mas brew install fica parado em Downloading https://ghcr.io/... até dar timeout. Na maioria das vezes o culpado é a forma como o Homebrew monta o ambiente antes de chamar curl e git: ele não repassa tudo o que está no seu shell, ignora o seu ~/.curlrc por padrão e tem um arquivo de configuração próprio com regras bem específicas.</p><p>Neste artigo junto o que a documentação oficial (a manpage do brew, em docs.brew.sh) e o próprio código-fonte do Homebrew dizem sobre isso, com base na versão 7.0.x. Os endereços nos exemplos são fictícios: troque proxy.example.com:3128 pelo seu proxy.</p><h3>1. O básico: variáveis de ambiente em minúsculas</h3><p>A seção “Using Homebrew behind a proxy” da manpage é curta: defina http_proxy, https_proxy, all_proxy, ftp_proxy e/ou no_proxy. Segundo a documentação, essas variáveis valem para o curl, o git e o svn que o Homebrew executa.</p><pre>export http_proxy=http://proxy.example.com:3128<br>export https_proxy=http://proxy.example.com:3128<br>export no_proxy=localhost,127.0.0.1,.intranet.example.com<br>brew update</pre><p>Para um proxy SOCKS5, a manpage usa all_proxy:</p><pre>export all_proxy=socks5://proxy.example.com:1080</pre><p>Se você quiser que a resolução de DNS também aconteça no proxy, o curl aceita o esquema socks5h://. Isso é comportamento do curl (e do git, que usa libcurl), não algo específico do Homebrew.</p><p>Proxy com autenticação segue o formato padrão de URL:</p><pre>export https_proxy=http://usuario:senha@proxy.example.com:3128</pre><p>Se a senha tiver caracteres como @, : ou #, codifique em URL (@ vira %40, : vira %3A). O curl decodifica antes de enviar ao proxy.</p><h3>2. Por que HTTP_PROXY e NO_PROXY em maiúsculas não funcionam</h3><p>Esse é o ponto que mais confunde. O script bin/brew não repassa o seu ambiente inteiro: ele executa o restante do Homebrew com env -i, ou seja, com um ambiente limpo, e copia só uma lista fixa de variáveis. A lista de proxy no código é esta:</p><pre>http_proxy https_proxy ftp_proxy no_proxy all_proxy HTTPS_PROXY FTP_PROXY ALL_PROXY</pre><p>Repare no que falta: HTTP_PROXY e NO_PROXY em maiúsculas. Como muitas ferramentas aceitam as duas formas, é comum ter só as maiúsculas no .zshrc. Para o Homebrew, o HTTP_PROXY some antes mesmo de chegar ao curl (que, aliás, também só lê http_proxy em minúsculas), e a lista de exceções em NO_PROXY é descartada.</p><p>A regra prática: para o Homebrew, use sempre as versões em minúsculas. Se outras ferramentas precisarem das maiúsculas, defina as duas:</p><pre>export http_proxy=http://proxy.example.com:3128<br>export https_proxy=$http_proxy<br>export no_proxy=localhost,127.0.0.1,.intranet.example.com<br>export HTTP_PROXY=$http_proxy HTTPS_PROXY=$https_proxy NO_PROXY=$no_proxy</pre><h3>3. Configuração permanente com brew.env</h3><p>Variáveis exportadas no shell não ajudam em scripts agendados ou execuções que não carregam o perfil do shell. Para isso o Homebrew lê arquivos de ambiente próprios, nesta ordem:</p><ol><li>/etc/homebrew/brew.env (sistema todo)</li><li>${HOMEBREW_PREFIX}/etc/homebrew/brew.env (por prefixo, por exemplo /opt/homebrew no Apple Silicon)</li><li>$XDG_CONFIG_HOME/homebrew/brew.env, se XDG_CONFIG_HOME estiver definido; caso contrário, ~/.homebrew/brew.env (por usuário)</li></ol><p>O arquivo do usuário tem prioridade sobre o do prefixo, que tem prioridade sobre o do sistema. A exceção é quando HOMEBREW_SYSTEM_ENV_TAKES_PRIORITY está definido no arquivo do sistema: aí ele é carregado de novo no final e sobrescreve os demais, o que é útil para administradores que querem impor um proxy.</p><p>A manpage fala em variáveis HOMEBREW_*, mas o código do bin/brew (desde a versão 5.0.0) também aceita nesses arquivos as variáveis de proxy em minúsculas: http_proxy, https_proxy, ftp_proxy, all_proxy e no_proxy. Um exemplo de ~/.homebrew/brew.env:</p><pre>http_proxy=http://proxy.example.com:3128<br>https_proxy=http://proxy.example.com:3128<br>no_proxy=localhost,127.0.0.1,.intranet.example.com</pre><p>Três cuidados com esse formato, todos vindos de como o arquivo é lido:</p><ul><li><strong>Sem </strong><strong>export.</strong> Só são aceitas linhas que começam com o nome da variável. Uma linha export http_proxy=... é ignorada sem aviso.</li><li><strong>Sem aspas.</strong> O valor é usado literalmente; aspas passam a fazer parte da URL.</li><li><strong>Sem expansão.</strong> A documentação avisa que não há expansão de variáveis ($HOME) nem execução de comandos ($(cat arquivo)). Por isso também não dá para buscar a senha em outro lugar: se o proxy exige senha, ela fica em texto puro no arquivo. Ajuste as permissões (chmod 600) ou prefira um proxy que autorize por endereço IP.</li></ul><p>Isso também importa para os comandos brew as-brew-user e brew as-console-user, pensados para scripts administrativos: segundo a manpage, eles rodam com o home do usuário-alvo, em um ambiente limpo, e carregam o brew.env dessa conta. O proxy exportado no shell de quem chama não chega lá; o que está no brew.env chega.</p><h3>4. O ~/.curlrc é ignorado por padrão</h3><p>Se você configurou o proxy em ~/.curlrc (proxy = ...) e o curl do terminal funciona, o Homebrew mesmo assim não vai usar. Ele chama o curl com --disable como primeiro argumento, justamente para não carregar o .curlrc.</p><p>A variável HOMEBREW_CURLRC muda isso:</p><ul><li>Com um caminho absoluto (começando com /), o Homebrew passa esse arquivo com --config, e só ele é carregado.</li><li>Com qualquer outro valor (por exemplo 1), o Homebrew deixa de passar --disable, e o curl volta a ler o .curlrc padrão.</li></ul><pre>export HOMEBREW_CURLRC=/Users/voce/.config/homebrew/curlrc</pre><p>Um detalhe que a documentação destaca: operações de Git, incluindo o brew update de repositórios, não usam esse arquivo, porque o Git tem transporte e configuração próprios. Se você usa taps de terceiros ou HOMEBREW_NO_INSTALL_FROM_API, o Git precisa do proxy por conta própria: via http_proxy/https_proxy (que o Homebrew repassa) ou via http.proxy no ~/.gitconfig.</p><h3>5. Quais domínios liberar e como usar um espelho interno</h3><p>Desde que o Homebrew passou a instalar a partir da API JSON, uma instalação comum fala com poucos destinos. Pelos valores padrão da manpage: os metadados vêm de https://formulae.brew.sh/api (HOMEBREW_API_DOMAIN), os bottles vêm de https://ghcr.io/v2/homebrew/core (HOMEBREW_BOTTLE_DOMAIN), e os repositórios Git ficam em github.com (HOMEBREW_BREW_GIT_REMOTE, HOMEBREW_CORE_GIT_REMOTE). Casks e fórmulas compiladas do código-fonte baixam dos sites dos próprios fornecedores, então a lista real depende do que a equipe instala.</p><p>Em empresas que não querem cada máquina saindo para a internet, a alternativa ao proxy é um espelho:</p><ul><li>HOMEBREW_ARTIFACT_DOMAIN prefixa todas as URLs de download. Uma fórmula com URL https://example.com/foo.tar.gz passa a ser baixada de http://localhost:8080/https://example.com/foo.tar.gz; nos bottles, o domínio é substituído.</li><li>Com HOMEBREW_ARTIFACT_DOMAIN_NO_FALLBACK também definido, o Homebrew dá erro em vez de tentar a URL original quando o espelho falha.</li><li>Se o espelho for um registry OCI que exige autenticação, use HOMEBREW_DOCKER_REGISTRY_TOKEN (bearer) ou HOMEBREW_DOCKER_REGISTRY_BASIC_AUTH_TOKEN (usuário e senha em base64).</li></ul><h3>6. Certificados de proxy corporativo e diagnóstico</h3><p>Proxies que inspecionam TLS apresentam um certificado da própria empresa. A manpage oferece HOMEBREW_FORCE_BREWED_CA_CERTIFICATES, que faz o Homebrew usar o pacote ca-certificates instalado pelo brew em vez do do sistema, e HOMEBREW_FORCE_BREWED_CURL, para preferir o curl do Homebrew. Seja qual for o caminho, a correção certa é fazer a CA da empresa ser confiável, não desligar a verificação de TLS.</p><p>Para descobrir onde a coisa trava:</p><pre>HOMEBREW_CURL_VERBOSE=1 brew fetch --force wget<br>brew config</pre><p>Com HOMEBREW_CURL_VERBOSE, o Homebrew passa --verbose ao curl, e dá para ver se a conexão vai para o proxy (CONNECT ghcr.io:443) ou direto para o destino. O brew config mostra a configuração do Homebrew e do sistema.</p><h3>Resumo</h3><ul><li>Use http_proxy, https_proxy e no_proxy em minúsculas. HTTP_PROXY e NO_PROXY em maiúsculas não passam pelo filtro do bin/brew.</li><li>Para configuração permanente, use brew.env: linhas NOME=valor, sem export, sem aspas, sem expansão.</li><li>~/.curlrc é ignorado, a menos que HOMEBREW_CURLRC esteja definido. O Git não usa esse arquivo.</li><li>Libere formulae.brew.sh, ghcr.io e github.com, ou use HOMEBREW_ARTIFACT_DOMAIN com um espelho interno.</li><li>Diagnostique com HOMEBREW_CURL_VERBOSE=1.</li></ul><p>Uma última observação prática: evite deixar senha de proxy em texto puro em arquivos como brew.env. Se o seu provedor (eu trabalho na <a href="https://www.flaship.com/">FlashIP</a>) aceita autorização por IP, uma máquina ou runner com IP fixo pode dispensar a senha na configuração. Vale confirmar isso diretamente com o provedor.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d294ecee5244" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[pip, uv ve conda için proxy ayarı: pip.conf, uv.toml, .condarc ve kurumsal sertifikalar]]></title>
            <link>https://medium.com/@leolin.flaship/pip-uv-ve-conda-i%C3%A7in-proxy-ayar%C4%B1-pip-conf-uv-toml-condarc-ve-kurumsal-sertifikalar-8fce9efb6652?source=rss-b4ddfea2fcaa------2</link>
            <guid isPermaLink="false">https://medium.com/p/8fce9efb6652</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[pip]]></category>
            <dc:creator><![CDATA[Leo Lin]]></dc:creator>
            <pubDate>Mon, 30 Nov 2026 10:07:16 GMT</pubDate>
            <atom:updated>2026-11-30T10:07:16.725Z</atom:updated>
            <content:encoded><![CDATA[<p>Yazan: Leo Lin, <a href="https://www.flaship.com/">FlashIP</a> Product Manager, Singapur. Açıklama: FlashIP’te çalışıyorum; FlashIP bir proxy sağlayıcısıdır.</p><p>Kurumsal bir ağda ya da çıkışı proxy üzerinden yapılan bir CI sunucusunda Python ortamı kurmaya çalışan herkes aynı manzarayı bilir: pip install zaman aşımına düşer, uv sync &quot;tunnel error&quot; verir, conda create ise SSL hatasıyla durur. Üç aracın da proxy desteği var, ama her biri ayarı farklı bir yerden okur ve öncelik sırası farklıdır.</p><p>Bu yazıda pip, uv ve conda için proxy ayarını; ortam değişkenlerini, yapılandırma dosyalarını ve SSL denetimi (SSL inspection) yapan kurumsal proxy’lerde sertifika sorununu adım adım ele alıyorum. Bilgiler pip 26.3, uv ve conda’nın resmi belgelerinden kontrol edildi; pip ve uv davranışını ayrıca küçük bir yerel test proxy’siyle denedim. Örneklerdeki host, port ve kullanıcı bilgileri temsilidir.</p><h3>1. pip</h3><h3>Komut satırı ve ortam değişkenleri</h3><p>pip belgelerine göre proxy dört şekilde verilebilir:</p><ul><li>--proxy seçeneği, scheme://[user:passwd@]proxy.server:port biçiminde;</li><li>yapılandırma dosyasındaki proxy anahtarı;</li><li>standart http_proxy, https_proxy ve no_proxy ortam değişkenleri;</li><li>--proxy seçeneğinin ortam değişkeni karşılığı olan PIP_PROXY.</li></ul><pre># Tek seferlik<br>python -m pip install --proxy http://proxy.example.com:8080 requests</pre><pre># Oturum boyunca<br>export https_proxy=http://proxy.example.com:8080<br>export http_proxy=http://proxy.example.com:8080<br>export no_proxy=localhost,127.0.0.1,pypi.internal.example.com<br>python -m pip install requests</pre><p>Dikkat edilmesi gereken iki sürüm notu var:</p><ul><li><strong>pip 24.1</strong> ile --proxy parametresi ortam değişkenlerine göre öncelikli hâle geldi. Yani https_proxy tanımlıyken --proxy verirseniz pip sizin verdiğiniz adresi kullanır. Testimde de böyle oldu: ortamda 18081 portu tanımlıyken --proxy http://127.0.0.1:18082 verdiğimde CONNECT isteği yalnızca 18082&#39;ye gitti.</li><li><strong>pip 26.2</strong> ile --no-proxy-env seçeneği (veya eşdeğeri --proxy &quot;&quot;) eklendi. Bu seçenek pip dışından gelen ortam değişkenlerindeki proxy ayarlarını yok sayar; --proxy ile açıkça verilen proxy yine kullanılır. Ortam değişkeni karşılığı PIP_NO_PROXY_ENV.</li></ul><p>--no-proxy-env, kabuğunuzda genel bir https_proxy olduğu hâlde iç ağdaki bir paket deposuna doğrudan bağlanmak istediğinizde işe yarar.</p><h3>pip.conf / pip.ini</h3><p>Kalıcı ayar için yapılandırma dosyası daha temizdir:</p><pre>[global]<br>proxy = http://proxy.example.com:8080<br>timeout = 60</pre><p>Dosyayı elle düzenlemek yerine şu komut da kullanılabilir:</p><pre>python -m pip config set global.proxy http://proxy.example.com:8080<br>python -m pip config debug   # hangi dosyaların okunduğunu gösterir</pre><p>Belgelere göre pip üç düzeyde dosya okur ve sırası global → user → site → PIP_CONFIG_FILE şeklindedir; sonra okunan dosya öncekini ezer. Ortam değişkenleri (ör. PIP_PROXY) tüm dosyaların üzerindedir. Linux&#39;ta tipik konumlar:</p><p>Düzey Konum Global /etc/xdg/pip/pip.conf, ardından /etc/pip.conf User $HOME/.config/pip/pip.conf (eski konum $HOME/.pip/pip.conf da okunur) Site $VIRTUAL_ENV/pip.conf</p><p>Windows’ta user dosyası %APPDATA%\pip\pip.ini, global dosya C:\ProgramData\pip\pip.ini olur. PIP_CONFIG_FILE değişkenini os.devnull değerine (Linux&#39;ta /dev/null) ayarlamak tüm yapılandırma dosyalarını devre dışı bırakır; &quot;bu ayar nereden geliyor?&quot; sorusunu yanıtlamak için kullanışlı bir yöntem.</p><h3>Sertifikalar</h3><p>pip, HTTPS bağlantılarında sertifika doğrulaması yapar. SSL denetimi yapan bir proxy arkasındaysanız seçenekler şunlar:</p><ul><li><strong>pip 24.2 ve sonrası</strong> varsayılan olarak truststore paketi üzerinden sistem sertifika deposunu, certifi&#39;ye ek olarak kullanır. Kurumsal kök sertifika işletim sistemine BT tarafından yüklenmişse çoğu zaman ek bir şey yapmanız gerekmez. Bu davranışı kapatmak için --use-deprecated=legacy-certs bayrağı var.</li><li>Belirli bir PEM dosyası kullanmak için --cert /yol/kurum-ca.pem veya PIP_CERT. pip belgeleri REQUESTS_CA_BUNDLE ve CURL_CA_BUNDLE değişkenlerinin de kullanılabileceğini belirtir.</li></ul><p>--trusted-host seçeneği bir hostu &quot;geçerli HTTPS&#39;i olmasa da güvenilir&quot; olarak işaretler. Sertifika hatasını susturur, ama sorunu çözmez; kalıcı çözüm olarak kullanmayın.</p><h3>2. uv</h3><h3>Ortam değişkenleri</h3><p>uv’nin ortam değişkenleri referansı şu değişkenleri listeler (hepsi uv 0.1.38&#39;den beri var):</p><ul><li>HTTP_PROXY: HTTP istekleri için proxy,</li><li>HTTPS_PROXY: HTTPS istekleri için proxy,</li><li>ALL_PROXY: tüm ağ istekleri için genel proxy,</li><li>NO_PROXY: proxy&#39;yi atlayacak hostların virgülle ayrılmış listesi; example.com gibi host adları ve 192.168.1.0/24 gibi desenler kabul eder.</li></ul><pre>export HTTPS_PROXY=http://proxy.example.com:8080<br>export NO_PROXY=localhost,127.0.0.1,10.0.0.0/8<br>uv sync</pre><p>Belgeler büyük harfli adları listeliyor. Benim testimde (uv 0.13.9) küçük harfli https_proxy da çalıştı; yine de pip belgelerinin küçük harf, uv belgelerinin büyük harf kullandığını düşünürsek, ikisini birlikte tanımlamak en sorunsuz yol.</p><h3>uv.toml</h3><p>uv’nin ayar referansında üç proxy anahtarı var: http-proxy, https-proxy ve no-proxy.</p><pre># ~/.config/uv/uv.toml  (Windows: %APPDATA%\uv\uv.toml)<br>http-proxy = &quot;http://proxy.example.com:8080&quot;<br>https-proxy = &quot;http://proxy.example.com:8080&quot;<br>no-proxy = [&quot;localhost&quot;, &quot;127.0.0.1&quot;, &quot;pypi.internal.example.com&quot;]</pre><p>Belgelerdeki örnekler bu anahtarları uv.toml biçiminde gösteriyor. uv, kullanıcı düzeyinde ~/.config/uv/uv.toml (macOS ve Linux) veya %APPDATA%\uv\uv.toml (Windows), sistem düzeyinde /etc/uv/uv.toml veya %PROGRAMDATA%\uv\uv.toml dosyalarını okur. Proje düzeyindeki ayar kullanıcı düzeyinin, kullanıcı düzeyi de sistem düzeyinin önündedir. Kullanıcı ve sistem düzeyindeki dosyalar pyproject.toml biçiminde olamaz. --no-config tüm kalıcı yapılandırmayı kapatır, --config-file ise belirli bir uv.toml dosyası verir.</p><p>Bir test notu: aynı anda hem HTTPS_PROXY (18081) hem de uv.toml içinde https-proxy (18082) tanımladığımda uv 0.13.9 bağlantıyı 18082&#39;ye, yani dosyadaki proxy&#39;ye yaptı. İki kaynağı birden kullanıyorsanız hangisinin kazandığını kendi sürümünüzde mutlaka kontrol edin. NO_PROXY=pypi.org,files.pythonhosted.org tanımladığımda ise uv proxy&#39;yi tamamen atlayıp doğrudan bağlandı.</p><h3>Sertifikalar</h3><p>uv, TLS için rustls kullanır ve varsayılan olarak <strong>paketle gelen Mozilla kök sertifikalarına</strong> güvenir; sistem deposuna bakmaz. Bu yüzden pip’in sorunsuz çalıştığı bir kurumsal makinede uv sertifika hatası verebilir. Çözümler:</p><ul><li>--system-certs bayrağı, UV_SYSTEM_CERTS=true ortam değişkeni ya da uv.toml içinde system-certs = true. Bu durumda doğrulamayı işletim sisteminin sertifika doğrulayıcısı yapar. (Eski UV_NATIVE_TLS / --native-tls artık kullanımdan kaldırılmış durumda; belgeler UV_SYSTEM_CERTS kullanılmasını öneriyor.)</li><li>SSL_CERT_FILE=/yol/kurum-bundle.pem: Varsayılan sertifika kaynağının yerine geçer ve <strong>yalnızca bu dosyadaki sertifikalara</strong> güvenilir. Dosya PEM olmalı; DER desteklenmiyor. Kurumsal CA&#39;yı tek başına verirseniz, proxy&#39;den geçmeyen bağlantılar bozulabilir.</li><li>SSL_CERT_DIR: PEM sertifikaları içeren bir veya daha fazla dizin (Unix&#39;te :, Windows&#39;ta ; ile ayrılır).</li></ul><p>--allow-insecure-host (UV_INSECURE_HOST) pip&#39;in --trusted-host seçeneğine benzer bir kaçış kapısıdır; aynı uyarı burada da geçerli.</p><h3>3. conda</h3><p>conda belgelerine göre proxy ayarları varsayılan olarak HTTP_PROXY ve HTTPS_PROXY ortam değişkenlerinden veya sistemden alınır. .condarc içinde proxy_servers tanımlarsanız bu varsayılanın yerine geçer:</p><pre># ~/.condarc<br>proxy_servers:<br>  http: http://proxy.example.com:8080<br>  https: http://proxy.example.com:8080</pre><p>Burada en sık yapılan hata şudur: http ve https <strong>anahtarları</strong> yönlendirilecek trafiğin türünü belirtir, proxy sunucusunun protokolünü değil. Proxy&#39;niz düz HTTP proxy ise https anahtarının değeri de http://... ile başlamalıdır. Belgeler bunu açıkça vurgular.</p><p>Belirli bir şema ve host için ayrı proxy de verilebilir; anahtar scheme://hostname biçiminde yazılır ve tam host adı eşleşmesi yapılır:</p><pre>proxy_servers:<br>  &#39;http://10.20.1.128&#39;: &#39;http://10.10.1.10:5323&#39;</pre><p>Kullanıcı adı ve parola URL içine yazılabilir. Yazılmazsa ya da kimlik doğrulama başarısız olursa conda sizden kullanıcı adı ve parola ister. Parolada özel karakter varsa percent-encoding kullanmanız gerekir (ör. @ → %40).</p><p>conda .condarc dosyasını birçok konumda arar: /etc/conda/.condarc, $XDG_CONFIG_HOME/conda/.condarc, ~/.config/conda/.condarc, ~/.conda/.condarc, ~/.condarc, $CONDA_PREFIX/.condarc gibi. Hangi dosyaların bulunduğunu ve son değeri şu komutlarla görebilirsiniz:</p><pre>conda config --show-sources<br>conda config --show proxy_servers</pre><h3>ssl_verify</h3><p>SSL denetimi yapan bir proxy (belgelerdeki örnek: Cisco IronPort WSA) arkasında ssl_verify ayarı devreye girer:</p><pre># Kurumsal CA işletim sisteminde zaten güvenilir ise (conda 23.9.0+)<br>ssl_verify: truststore</pre><pre># Ya da belirli bir sertifika dosyası<br>ssl_verify: /yol/kurum-ca.pem</pre><p>ssl_verify: False da mümkün, ancak belgeler bunun bağlantının normal güvenliğini kapattığını ve önerilmediğini açıkça söylüyor. conda&#39;nın &quot;standart dışı sertifikalar&quot; sayfası ayrıca REQUESTS_CA_BUNDLE değişkenini anlatır ve DER biçimli bir kök sertifikanın openssl x509 -inform der -in kok.cer -out kok.pem ile PEM&#39;e çevrilmesini gösterir.</p><h3>4. Hızlı sorun giderme</h3><p>Belirti Olası neden Kontrol pip zaman aşımı Proxy hiç kullanılmıyor python -m pip config debug, env \| grep -i proxy uv&#39;de tunnel error: unsuccessful Proxy CONNECT&#39;i reddetti (yetki, 407 vb.) Aynı proxy ile curl -v -x ... https://pypi.org/simple/ uv&#39;de sertifika hatası, pip&#39;te yok uv varsayılan olarak sistem deposunu kullanmıyor UV_SYSTEM_CERTS=true conda HTTPS&#39;te takılıyor https: değeri yanlış şemayla yazılmış conda config --show proxy_servers İç ağdaki depo proxy&#39;ye gidiyor no_proxy / NO_PROXY eksik pip için --no-proxy-env, uv için no-proxy</p><h3>Güvenlik üzerine kısa bir not</h3><p>pip.conf, uv.toml veya .condarc içine user:parola@ yazmak pratik, ama bu dosyalar zamanla dotfile depolarına, Docker imajlarına ve CI loglarına sızar. Dosyaya mümkünse kimlik bilgisi olmayan bir URL yazın, parolayı CI&#39;ın gizli değişkenlerinden ortam değişkeni olarak verin, dosya izinlerini chmod 600 ile kısıtlayın. Ortam değişkeni kullanırken env çıktısını loglayan adımlara dikkat edin.</p><h3>Özet</h3><ul><li><strong>pip</strong>: --proxy &gt; PIP_PROXY &gt; yapılandırma dosyası; ortamdaki https_proxy da okunur. 24.1&#39;den beri --proxy önce gelir, 26.2&#39;den beri --no-proxy-env var. 24.2&#39;den beri sistem sertifikaları varsayılan olarak kullanılır.</li><li><strong>uv</strong>: HTTPS_PROXY / ALL_PROXY / NO_PROXY veya uv.toml içinde https-proxy / no-proxy. Kurumsal CA için UV_SYSTEM_CERTS=true.</li><li><strong>conda</strong>: .condarc içinde proxy_servers; anahtar trafik türünü, değer proxy&#39;nin gerçek şemasını belirtir. SSL denetimi için ssl_verify: truststore veya bir CA dosyası.</li></ul><p>Sabit IP’li build sunucularında ücretli bir proxy kullanıyorsanız, örneğin <a href="https://www.flaship.com/">FlashIP</a>, ve sağlayıcınız destekliyorsa, IP beyaz listesiyle kimlik doğrulama bu üç dosyanın hiçbirine parola yazmamanızı sağlar.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8fce9efb6652" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Git und npm hinter einem Proxy einrichten: http.proxy, https-proxy, noproxy und Firmenzertifikate]]></title>
            <link>https://medium.com/@leolin.flaship/git-und-npm-hinter-einem-proxy-einrichten-http-proxy-https-proxy-noproxy-und-firmenzertifikate-793ed74a3948?source=rss-b4ddfea2fcaa------2</link>
            <guid isPermaLink="false">https://medium.com/p/793ed74a3948</guid>
            <category><![CDATA[npm]]></category>
            <category><![CDATA[git]]></category>
            <dc:creator><![CDATA[Leo Lin]]></dc:creator>
            <pubDate>Wed, 25 Nov 2026 19:21:01 GMT</pubDate>
            <atom:updated>2026-11-25T19:21:01.019Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Von Leo Lin, Product Manager bei </em><a href="https://www.flaship.com/"><em>FlashIP</em></a><em> in Singapur. Offenlegung: Ich arbeite für FlashIP, einen Proxy-Anbieter — bitte beim Lesen im Hinterkopf behalten.</em></p><p>Der Klassiker im Firmennetz: Der Browser lädt jede Seite, aber git clone hängt, und npm install bricht nach einer Weile mit ETIMEDOUT oder SELF_SIGNED_CERT_IN_CHAIN ab. Am Proxy liegt das selten. Git und npm haben jeweils eigene Proxy-Einstellungen, lesen zusätzlich Umgebungsvariablen – und diese Quellen kommen sich gern in die Quere. Hier ist die Reihenfolge, in der ich so ein Setup angehe. Alle Hosts im Text (proxy.example.com:3128) sind Platzhalter.</p><h3>Schritt 0: Wo soll die Einstellung wohnen?</h3><p>Ein Proxy kann aus drei Ecken kommen:</p><ol><li><strong>Umgebungsvariablen</strong> wie http_proxy, https_proxy, all_proxy und no_proxy (auch in Großbuchstaben),</li><li>der <strong>Git-Konfiguration</strong> (~/.gitconfig oder .git/config im Repository),</li><li>der <strong>npm-Konfiguration</strong> (~/.npmrc oder .npmrc im Projekt).</li></ol><p>Meine Faustregel: Auf CI-Runnern, wo jeder Job sauber startet, sind Umgebungsvariablen praktisch. Auf dem eigenen Laptop ist die tool-spezifische Konfiguration besser, weil sie nachvollziehbar bleibt und sich gezielt wieder entfernen lässt. Bevor man irgendetwas ändert, lohnt sich ein kurzer Blick auf alte Reste:</p><pre>env | grep -i proxy</pre><h3>Git: http.proxy global oder nur für einen Host</h3><p>Git nutzt für HTTP- und HTTPS-Remotes libcurl. Der wichtigste Schlüssel heißt http.proxy und gilt trotz des Namens auch für <a href="https://-urls/">https://-URLs:</a></p><pre>git config --global http.proxy http://proxy.example.com:3128</pre><p>Soll nur GitHub über den Proxy laufen, während der interne Git-Server direkt erreichbar bleibt, lässt sich die Einstellung an eine URL binden:</p><pre>git config --global http.https://github.com.proxy http://proxy.example.com:3128</pre><p>Für SOCKS5 empfiehlt sich socks5h://proxy.example.com:1080. Das „h“ bedeutet, dass der Proxy die Hostnamen auflöst und nicht dein Rechner – hilfreich, wenn das lokale DNS externe Hosts nicht kennt.</p><p><strong>Die SSH-Falle:</strong> Ein Remote im Format git@github.com:org/repo.git läuft über SSH und ignoriert http.proxy komplett. Entweder stellst du das Remote auf HTTPS um oder trägst in ~/.ssh/config ein ProxyCommand ein.</p><p>Rückgängig machen:</p><pre>git config --global --unset http.proxy</pre><h3>npm: zwei Schlüssel, nicht einer</h3><p>Der häufigste Fehler, den ich sehe: Es wird nur proxy gesetzt. Die npm-Registry spricht aber HTTPS, also ist https-proxy der Wert, auf den es eigentlich ankommt:</p><pre>npm config set proxy http://proxy.example.com:3128<br>npm config set https-proxy http://proxy.example.com:3128<br>npm config set noproxy &quot;localhost,127.0.0.1,.intern.example.com&quot;</pre><p>Dass die URL bei https-proxy mit http:// beginnt, ist kein Tippfehler. Der Schlüssel beschreibt, welcher Proxy für HTTPS-Anfragen benutzt wird; die Verbindung zum Proxy selbst ist meist einfaches HTTP. Wer eine interne Registry betreibt, sollte deren Domain unbedingt in noproxy eintragen, sonst versucht npm, sie über den externen Proxy zu erreichen.</p><p>npm berücksichtigt außerdem HTTP_PROXY und HTTPS_PROXY aus der Umgebung. Sieht die .npmrc korrekt aus und der Traffic landet trotzdem woanders, ist das der erste Verdächtige. Entfernen lassen sich die Werte mit npm config delete proxy und npm config delete https-proxy.</p><h3>Firmenzertifikate: Prüfung nicht abschalten</h3><p>Viele Unternehmensproxys brechen TLS auf und signieren den Verkehr mit einer eigenen Root-CA neu. Git meldet dann SSL certificate problem, npm SELF_SIGNED_CERT_IN_CHAIN. Die schnelle „Lösung“ – http.sslVerify false oder strict-ssl false – schaltet den Schutz für alles ab. Besser: das CA-Zertifikat bei der IT anfragen und den Tools mitteilen:</p><pre>git config --global http.sslCAInfo /pfad/zur/firmen-ca.pem<br>npm config set cafile /pfad/zur/firmen-ca.pem<br>export NODE_EXTRA_CA_CERTS=/pfad/zur/firmen-ca.pem</pre><p>NODE_EXTRA_CA_CERTS braucht man vor allem für postinstall-Skripte, die selbst mit Node.js Binärdateien herunterladen.</p><h3>Zugangsdaten nicht im Klartext verteilen</h3><p>http://nutzer:passwort@proxy.example.com:3128 in der .gitconfig funktioniert, landet aber früher oder später in einem Dotfiles-Repo oder auf einem Screenshot. Git kann es eleganter: Gibst du nur den Benutzernamen an (http://nutzer@proxy.example.com:3128), fragt Git das Passwort über sein Credential-System ab, und ein Credential-Helper kann es sicher speichern. In der CI gehört die vollständige URL in den Secret-Store und wird erst zur Laufzeit injiziert. Sonderzeichen im Passwort müssen URL-kodiert werden, aus @ wird %40.</p><p>Noch einfacher ist Authentifizierung per IP-Whitelist, dann gibt es gar kein Passwort zu verstecken. Bei <a href="https://www.flaship.com/">FlashIP</a> etwa funktionieren HTTP(S)- und SOCKS5-Proxys wahlweise mit Benutzername/Passwort oder mit IP-Whitelist — für einen Runner mit fester ausgehender IP ist Letzteres angenehm.</p><h3>Testen statt vertrauen</h3><p>Eine Konfigurationsdatei beweist nichts, eine echte Anfrage schon:</p><pre>GIT_CURL_VERBOSE=1 git ls-remote https://github.com/git/git 2&gt;&amp;1 | grep -i proxy<br>npm config list<br>npm view lodash version</pre><h3>Kurz-Checkliste zur Fehlersuche</h3><ul><li><strong>407 Proxy Authentication Required:</strong> Zugangsdaten falsch oder nicht URL-kodiert.</li><li><strong>Git klappt, npm nicht:</strong> https-proxy fehlt.</li><li><strong>Lokal okay, in der CI nicht:</strong> Der Runner kennt dein Shell-Profil nicht — Variablen in der Job-Definition setzen.</li><li><strong>Interne Hosts laufen in Timeouts:</strong> in no_proxy bzw. noproxy aufnehmen.</li><li><strong>git@… hängt:</strong> Das ist SSH – ProxyCommand oder HTTPS-Remote.</li></ul><p>Ist jedes Tool an der richtigen Stelle konfiguriert, merkt man vom Proxy nichts mehr. Genau so soll es sein.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=793ed74a3948" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Docker atrás de proxy: como configurar docker pull, docker build e os containers sem vazar senha]]></title>
            <link>https://medium.com/@leolin.flaship/docker-atr%C3%A1s-de-proxy-como-configurar-docker-pull-docker-build-e-os-containers-sem-vazar-senha-40b72acd4c81?source=rss-b4ddfea2fcaa------2</link>
            <guid isPermaLink="false">https://medium.com/p/40b72acd4c81</guid>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[proxy]]></category>
            <dc:creator><![CDATA[Leo Lin]]></dc:creator>
            <pubDate>Wed, 25 Nov 2026 19:05:41 GMT</pubDate>
            <atom:updated>2026-11-25T19:05:41.598Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Por Leo Lin, Product Manager na </em><a href="https://www.flaship.com/"><em>FlashIP</em></a><em>, em Singapura. Transparência: eu trabalho na FlashIP, que é um provedor de proxy, então leve isso em conta ao ler.</em></p><p>Se você já trabalhou com Docker numa rede corporativa ou num runner de CI com saída controlada, provavelmente passou por isto: você exporta HTTP_PROXY no terminal, roda docker pull e... nada muda, continua dando timeout. Não é bug. O Docker simplesmente não tem <em>uma</em> configuração de proxy — ele tem várias, e cada uma vale para um processo diferente. Mexer no lugar errado não resolve nada.</p><p>Neste post eu organizo essas camadas do jeito que uso no dia a dia, sempre com base na documentação oficial do Docker. Em todos os exemplos o proxy é um placeholder: proxy.example.com:3128.</p><h3>Primeiro diagnóstico: quem está tentando sair para a internet?</h3><p>Antes de editar qualquer arquivo, responda a uma pergunta: qual processo está falhando?</p><ul><li><strong>O daemon (</strong><strong>dockerd)</strong> é quem conversa com o Docker Hub e com outros registries. Todo docker pull passa por ele.</li><li><strong>O </strong><strong>~/.docker/config.json do cliente</strong> <em>não</em> faz a CLI nem a engine usarem o proxy. Ele injeta variáveis de proxy em containers e builds novos.</li><li><strong>--build-arg e </strong><strong>--env</strong> servem para sobrescrever valores em um único comando.</li></ul><p>Resumindo: se o pull falha, o problema é o daemon. Se o pull funciona mas um apt-get update ou pip install dentro de um RUN trava, o problema é o build.</p><h3>Camada 1: o daemon, para o docker pull funcionar</h3><p>No Docker Engine no Linux, o caminho recomendado é o daemon.json, normalmente em /etc/docker/daemon.json:</p><pre>{<br>  &quot;proxies&quot;: {<br>    &quot;http-proxy&quot;: &quot;http://proxy.example.com:3128&quot;,<br>    &quot;https-proxy&quot;: &quot;http://proxy.example.com:3128&quot;,<br>    &quot;no-proxy&quot;: &quot;*.test.example.com,.example.org,127.0.0.0/8&quot;<br>  }<br>}</pre><p>Depois, reinicie o serviço:</p><pre>sudo systemctl restart docker</pre><p>Também dá para usar as flags --http-proxy e --https-proxy do dockerd, ou variáveis de ambiente num drop-in do systemd. Detalhe importante: o que está na configuração do daemon tem precedência sobre as variáveis de ambiente. Se preferir o systemd, crie /etc/systemd/system/docker.service.d/http-proxy.conf:</p><pre>[Service]<br>Environment=&quot;HTTP_PROXY=http://proxy.example.com:3128&quot;<br>Environment=&quot;HTTPS_PROXY=http://proxy.example.com:3128&quot;<br>Environment=&quot;NO_PROXY=localhost,127.0.0.1,docker-registry.example.com,.corp&quot;</pre><p>Recarregue, reinicie e confira se os valores entraram:</p><pre>sudo systemctl daemon-reload<br>sudo systemctl restart docker<br>sudo systemctl show --property=Environment docker</pre><p>Duas pegadinhas que já me custaram uma tarde:</p><ul><li><strong>No systemd, caracteres especiais precisam de escape duplo com </strong><strong>%%.</strong> Um # na senha vira %%23. Se a autenticação só falha quando o Docker roda como serviço, comece por aqui.</li><li><strong>Docker rootless usa outro caminho:</strong> ~/.config/systemd/user/docker.service.d/, com systemctl --user e sem sudo.</li></ul><p><strong>Usa Docker Desktop?</strong> Ele ignora as entradas de proxy do daemon.json. A configuração fica na seção <em>Proxies</em> das Settings. O Desktop ainda tem um &quot;Containers proxy&quot; próprio, que é sempre usado por docker pull e pelos pulls do Compose — se o download de imagens falha, é esse campo que você precisa revisar.</p><h3>Camada 2: ~/.docker/config.json, para builds e containers</h3><p>O proxy do daemon vale só para o tráfego do próprio daemon. O que roda dentro de um RUN ou de um container em execução lê o proxy do ambiente. Para isso, adicione um bloco proxies no ~/.docker/config.json:</p><pre>{<br>  &quot;proxies&quot;: {<br>    &quot;default&quot;: {<br>      &quot;httpProxy&quot;: &quot;http://proxy.example.com:3128&quot;,<br>      &quot;httpsProxy&quot;: &quot;http://proxy.example.com:3128&quot;,<br>      &quot;noProxy&quot;: &quot;localhost,127.0.0.1,.internal.example.com&quot;<br>    }<br>  }<br>}</pre><p>Com isso, o Docker define HTTP_PROXY/http_proxy, HTTPS_PROXY/https_proxy e NO_PROXY/no_proxy como variáveis de ambiente e como build args (ftpProxy e allProxy também são aceitos). Não precisa reiniciar nada, mas a configuração só vale para containers e builds <strong>novos</strong> — o que já está rodando continua com o ambiente antigo.</p><p>A chave default vale para todos os daemons com que o cliente se conecta. Se você também usa um daemon remoto que não deve passar pelo proxy, crie uma chave com o endereço dele, por exemplo tcp://docker-daemon1.example.com, e ajuste o noProxy ali.</p><p>Teste rápido:</p><pre>docker run --rm alpine sh -c &#39;env | grep -i _proxy&#39;</pre><h3>Camada 3: valores pontuais na linha de comando</h3><p>Para um build ou container específico, passe o valor direto:</p><pre>docker build --build-arg HTTPS_PROXY=&quot;http://proxy.example.com:3128&quot; .<br>docker run --env HTTPS_PROXY=&quot;http://proxy.example.com:3128&quot; redis</pre><p>HTTP_PROXY, HTTPS_PROXY, FTP_PROXY, NO_PROXY e ALL_PROXY (e as versões em minúsculas) são build args predefinidos, então você não precisa de uma linha ARG no Dockerfile para usá-los.</p><h3>Credencial de proxy não é para morar na imagem</h3><ul><li><strong>Não use </strong><strong>ENV para proxy no Dockerfile.</strong> A documentação do Docker recomenda build args. Com ENV, o proxy fica gravado na imagem, containers rodando em outra rede quebram e credenciais podem vazar.</li><li><strong>Não declare </strong><strong>ARG HTTP_PROXY sem necessidade.</strong> Por padrão, os build args de proxy predefinidos ficam fora do docker history e não afetam o cache. Se você declara ARG HTTP_PROXY explicitamente, o valor aparece no histórico e qualquer mudança invalida o cache.</li><li><strong>Variável de ambiente não é segredo.</strong> Segundo o Docker, elas ficam em texto puro, podem ser lidas pela API remota e podem acabar numa imagem via docker commit.</li></ul><p>Por isso, em servidores de build, quando o provedor permite, eu prefiro autenticação por allowlist de IP: sem senha na URL, não há senha para vazar. A <a href="https://www.flaship.com/">FlashIP</a>, por exemplo, suporta HTTP(S) e SOCKS5 e aceita autenticação por usuário e senha ou por allowlist de IP — um runner de CI com IP de saída fixo pode funcionar sem credencial nenhuma. Se precisar mesmo de usuário e senha, guarde no secret store do seu CI e passe só na hora do build com --build-arg.</p><h3>Checklist de troubleshooting</h3><ul><li>docker pull falha → configuração do daemon (ou o &quot;Containers proxy&quot; no Docker Desktop).</li><li>O pull funciona, mas RUN apt-get update falha → ~/.docker/config.json ou --build-arg.</li><li>Tudo certo, menos o registry interno → inclua o host em no-proxy / NO_PROXY.</li><li>Erro de autenticação só com systemd → confira o escape com %%.</li><li>Valor novo não pegou → o container é de antes da mudança? Recrie, porque a configuração só vale para containers novos.</li></ul><p>Acertando a camada certa, a maioria dos “o Docker está ignorando meu proxy” se resolve sozinha. Se você tiver um caso diferente, deixa nos comentários.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=40b72acd4c81" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Use a Proxy in WSL 2: autoProxy, .wslconfig,]]></title>
            <link>https://medium.com/@leolin.flaship/how-to-use-a-proxy-in-wsl-2-autoproxy-wslconfig-b90d259ec331?source=rss-b4ddfea2fcaa------2</link>
            <guid isPermaLink="false">https://medium.com/p/b90d259ec331</guid>
            <category><![CDATA[wsl]]></category>
            <category><![CDATA[proxy]]></category>
            <category><![CDATA[windows]]></category>
            <dc:creator><![CDATA[Leo Lin]]></dc:creator>
            <pubDate>Tue, 24 Nov 2026 18:13:05 GMT</pubDate>
            <atom:updated>2026-11-24T18:13:05.650Z</atom:updated>
            <content:encoded><![CDATA[<h3>How to Use a Proxy in WSL 2: autoProxy, .wslconfig, Mirrored Networking and Manual Settings for NAT Mode</h3><p>Windows has a proxy set, the browser works, and then curl or pip install inside Ubuntu on WSL 2 times out. Or the opposite: WSL picks up a proxy you never set in Linux at all. Both come from the same place. WSL 2 runs Linux in a lightweight VM with its own network stack, and it has its own rules for copying (or not copying) the Windows proxy into Linux. This guide covers the three setups you will meet: automatic proxy from Windows, mirrored networking with a local proxy app, and manual settings for the default NAT mode. proxy.example.net:8000 and USER:PASS are placeholders.</p><h3>Step 1: know which networking mode you are in</h3><p>Everything below depends on networkingMode in %UserProfile%\.wslconfig (the global WSL 2 config file on the Windows side, not inside the distro). The file doesn&#39;t exist by default. The mode is NAT unless you change it. Microsoft documents these values: none, nat, mirrored, consomme, and bridged (deprecated). Mirrored mode requires Windows 11 22H2 or later.</p><pre>[wsl2]<br>networkingMode=mirrored<br>autoProxy=true</pre><p>Changes apply only after the WSL VM fully stops. Microsoft calls this the “8 second rule”. The quick way is to run this from PowerShell:</p><pre>wsl --shutdown</pre><p>Then open your distro again.</p><h3>Step 2: let autoProxy copy the Windows proxy</h3><p>On Windows 11, autoProxy defaults to true. The docs describe it as enforcing &quot;WSL to use Windows&#39; HTTP proxy information&quot;. So if you set a proxy in Windows, WSL sets it in Linux too. Check what you actually got:</p><pre>env | grep -i -E &#39;_proxy|WSL_PAC_URL&#39;</pre><p>Looking at the WSL source code shows what to expect. WSL writes both lowercase and uppercase http_proxy, https_proxy and no_proxy, because some Linux tools read one case and some read the other. If Windows uses a PAC script, WSL also sets WSL_PAC_URL. Linux tools don&#39;t read that variable themselves. It just makes the URL available, so you can fetch the PAC file and point your tools at the right proxy.</p><p>Two practical notes:</p><ul><li><strong>Timing.</strong> WSL waits for the Windows proxy lookup when the VM starts. The wait is set by initialAutoProxyTimeout in the [experimental] section, 1000 ms by default. If the lookup finishes later, the docs say you have to restart the WSL instance to pick it up. If the variables are sometimes missing after boot, raise this value.</li><li><strong>Turning it off.</strong> If you want Linux to have its own proxy settings, or none, set autoProxy=false under [wsl2] and run wsl --shutdown.</li></ul><h3>Step 3: a proxy app on Windows localhost needs mirrored mode</h3><p>A common setup is a local proxy client on Windows listening on 127.0.0.1:7890 or similar, with Windows pointed at it. In NAT mode that address means nothing inside Linux: 127.0.0.1 in the VM is the VM itself. WSL&#39;s code rejects loopback proxy addresses when it isn&#39;t in mirrored mode. Instead of copying the setting, it shows this warning:</p><blockquote><em>A localhost proxy configuration was detected but not mirrored into WSL. This proxy address is not supported by the current networking configuration.</em></blockquote><p>The fix is networkingMode=mirrored. Microsoft&#39;s networking page says that in mirrored mode Linux can reach Windows servers at 127.0.0.1. The IPv6 loopback ::1 is not supported, so point the Windows proxy at 127.0.0.1, not [::1]. After wsl --shutdown, the variables from autoProxy should work as they are:</p><pre>curl -sS -o /dev/null -w &#39;%{http_code}\n&#39; https://example.com</pre><h3>Step 4: manual settings for NAT mode</h3><p>If you stay on NAT, or you turned autoProxy off, set the variables yourself. There are two cases.</p><p><strong>The proxy is a remote host</strong> (a corporate gateway or a provider endpoint). Linux can reach it directly, so set it like on any Linux machine, for example in ~/.bashrc:</p><pre>export http_proxy=http://USER:PASS@proxy.example.net:8000<br>export https_proxy=$http_proxy<br>export no_proxy=localhost,127.0.0.1,::1<br>export HTTP_PROXY=$http_proxy HTTPS_PROXY=$https_proxy NO_PROXY=$no_proxy</pre><p><strong>The proxy runs on the Windows host.</strong> In NAT mode, Microsoft’s networking page shows how to find the Windows host’s IP from inside Linux:</p><pre>WIN_HOST=$(ip route show | grep -i default | awk &#39;{ print $3}&#39;)<br>export http_proxy=http://$WIN_HOST:7890 https_proxy=http://$WIN_HOST:7890</pre><p>Two catches, both from the same page. First, connections over that IP count as LAN connections. The Windows app must accept them, which usually means a “listen on all interfaces” or “allow LAN” option, or binding to 0.0.0.0 instead of 127.0.0.1. Second, Windows Firewall rules apply, and the Hyper-V firewall is on by default with WSL 2.0.9 or later, so you may need a rule for the proxy port. The host IP can also change after a restart, which is why the snippet looks it up each time instead of hard-coding it.</p><h3>Things that still bypass the variables</h3><p>Shell variables only reach programs that inherit them. sudo normally drops them because of env_reset. Tools with their own config files (apt, Docker, Git, npm) may need their own settings. If your distro runs systemd, services don&#39;t read ~/.bashrc either. These rules are the same as on any Linux machine, so the usual per-layer fixes work inside WSL too.</p><h3>Wrapping up</h3><p>When a proxy misbehaves in WSL 2, check the networking mode first. NAT plus a localhost proxy on Windows won’t work. Mirrored mode or an explicit host IP will. After that, decide whether autoProxy or your own variables should be in charge, and confirm with env and one curl. Any standard HTTP or SOCKS5 endpoint works in these setups, including FlashIP&#39;s proxies (<a href="https://www.flaship.com/">www.flaship.com</a>).</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b90d259ec331" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Cómo configurar un proxy para Docker: docker pull, docker build y contenedores]]></title>
            <link>https://medium.com/@leolin.flaship/c%C3%B3mo-configurar-un-proxy-para-docker-docker-pull-docker-build-y-contenedores-e8b2740770b8?source=rss-b4ddfea2fcaa------2</link>
            <guid isPermaLink="false">https://medium.com/p/e8b2740770b8</guid>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[proxy]]></category>
            <category><![CDATA[docker]]></category>
            <dc:creator><![CDATA[Leo Lin]]></dc:creator>
            <pubDate>Tue, 24 Nov 2026 16:55:02 GMT</pubDate>
            <atom:updated>2026-11-24T16:55:02.820Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Por Leo Lin, Product Manager en </em><a href="https://www.flaship.com/"><em>FlashIP</em></a><em> (Singapur). Trabajo en una empresa de proxies, así que tenlo en cuenta al leer.</em></p><p>Si alguna vez has exportado HTTP_PROXY en la terminal, has lanzado docker pull y has visto cómo se queda colgado igual que antes, no es culpa tuya. Docker no tiene <em>un</em> ajuste de proxy: tiene varios, y cada uno cubre una parte distinta del proceso. Si tocas el que no es, no cambia nada.</p><p>En esta guía repaso los tres sitios donde se configura el proxy en Docker, cuándo usar cada uno y cómo evitar que las credenciales acaben dentro de tus imágenes. Todo está contrastado con la documentación oficial de Docker. En los ejemplos uso proxy.example.com:3128 como proxy de prueba.</p><h3>Primero, el mapa: ¿quién sale a Internet?</h3><p>Antes de tocar nada, aclara qué proceso hace cada conexión:</p><ol><li><strong>El daemon (</strong><strong>dockerd)</strong> es quien habla con Docker Hub y con cualquier registro. docker pull pasa por aquí.</li><li><strong>La configuración del cliente (</strong><strong>~/.docker/config.json)</strong> no hace que el CLI ni el motor usen el proxy. Lo que hace es <em>inyectar</em> variables de proxy en los contenedores y builds nuevos.</li><li><strong>Los argumentos de build y las variables de entorno</strong> (--build-arg, --env) sirven para sobrescribir valores en un comando concreto.</li></ol><p>La regla rápida: si falla el pull, es cosa del daemon; si falla un apt-get update o un pip install dentro de un RUN, es cosa del build.</p><h3>1. Arreglar docker pull: el proxy del daemon</h3><p>En Docker Engine para Linux, la forma recomendada es el archivo daemon.json, normalmente en /etc/docker/daemon.json:</p><pre>{<br>  &quot;proxies&quot;: {<br>    &quot;http-proxy&quot;: &quot;http://proxy.example.com:3128&quot;,<br>    &quot;https-proxy&quot;: &quot;http://proxy.example.com:3128&quot;,<br>    &quot;no-proxy&quot;: &quot;*.test.example.com,.example.org,127.0.0.0/8&quot;<br>  }<br>}</pre><p>Después reinicia el servicio:</p><pre>sudo systemctl restart docker</pre><p>También existen las opciones --http-proxy y --https-proxy de dockerd, o las variables de entorno en un drop-in de systemd. Ojo: lo que pongas en la configuración del daemon tiene prioridad sobre las variables de entorno. Si prefieres systemd, crea /etc/systemd/system/docker.service.d/http-proxy.conf:</p><pre>[Service]<br>Environment=&quot;HTTP_PROXY=http://proxy.example.com:3128&quot;<br>Environment=&quot;HTTPS_PROXY=http://proxy.example.com:3128&quot;<br>Environment=&quot;NO_PROXY=localhost,127.0.0.1,docker-registry.example.com,.corp&quot;</pre><p>Recarga y comprueba que se ha aplicado:</p><pre>sudo systemctl daemon-reload<br>sudo systemctl restart docker<br>sudo systemctl show --property=Environment docker</pre><p>Dos detalles que cuestan tardes enteras:</p><ul><li><strong>En systemd, los caracteres especiales se escapan dos veces con </strong><strong>%%.</strong> Una contraseña con # se convierte en %%23. Si la autenticación falla solo con el servicio, mira esto primero.</li><li><strong>Docker rootless usa otra ruta:</strong> ~/.config/systemd/user/docker.service.d/, y los comandos van con systemctl --user, sin sudo.</li></ul><p><strong>¿Usas Docker Desktop?</strong> Desktop ignora los proxies definidos en daemon.json. Tienes que ir a la sección <em>Proxies</em> de los ajustes. Además, Desktop tiene un &quot;Containers proxy&quot; propio por el que pasan siempre docker pull y los pulls de Compose: si falla la descarga de imágenes, revisa ese campo.</p><h3>2. Arreglar los RUN dentro del build: ~/.docker/config.json</h3><p>El proxy del daemon solo sirve para el tráfico del propio daemon. Los comandos que se ejecutan dentro de un paso RUN leen el proxy de su entorno. Para eso se añade un bloque proxies en ~/.docker/config.json:</p><pre>{<br>  &quot;proxies&quot;: {<br>    &quot;default&quot;: {<br>      &quot;httpProxy&quot;: &quot;http://proxy.example.com:3128&quot;,<br>      &quot;httpsProxy&quot;: &quot;http://proxy.example.com:3128&quot;,<br>      &quot;noProxy&quot;: &quot;localhost,127.0.0.1,.internal.example.com&quot;<br>    }<br>  }<br>}</pre><p>Con esto, Docker define HTTP_PROXY/http_proxy, HTTPS_PROXY/https_proxy y NO_PROXY/no_proxy (y también ftpProxy y allProxy si los añades) como variables de entorno y como argumentos de build. No hace falta reiniciar nada, pero solo afecta a contenedores y builds <strong>nuevos</strong>; lo que ya está corriendo conserva su entorno anterior.</p><p>La clave default se aplica a todos los daemons a los que se conecte el cliente. Si trabajas con un daemon remoto que no debe usar el proxy, añade una clave con su dirección (por ejemplo tcp://docker-daemon1.example.com) y ajusta ahí su noProxy.</p><p>Para comprobarlo en diez segundos:</p><pre>docker run --rm alpine sh -c &#39;env | grep -i _proxy&#39;</pre><h3>3. Cambios puntuales desde la línea de comandos</h3><p>Para un único build o contenedor, pasa el valor directamente:</p><pre>docker build --build-arg HTTPS_PROXY=&quot;http://proxy.example.com:3128&quot; .<br>docker run --env HTTPS_PROXY=&quot;http://proxy.example.com:3128&quot; redis</pre><p>HTTP_PROXY, HTTPS_PROXY, FTP_PROXY, NO_PROXY y ALL_PROXY (y sus versiones en minúscula) son argumentos predefinidos, así que no necesitas declarar una línea ARG para usarlos.</p><h3>Que las credenciales no acaben en la imagen</h3><ul><li><strong>No uses </strong><strong>ENV para el proxy en el Dockerfile.</strong> La documentación de Docker lo dice claramente: usa argumentos de build. Con ENV el proxy queda grabado en la imagen, rompe los contenedores en otras redes y puede filtrar credenciales.</li><li><strong>No declares </strong><strong>ARG HTTP_PROXY si no lo necesitas.</strong> Por defecto, los argumentos de proxy predefinidos no aparecen en docker history ni afectan a la caché. Si añades un ARG HTTP_PROXY explícito, el valor sí aparece en el historial y cambiarlo invalida la caché.</li><li><strong>Las variables de entorno se pueden leer.</strong> Docker advierte que se guardan en texto plano, se pueden consultar a través de la API remota y pueden terminar en una imagen con docker commit.</li></ul><p>Por eso, en servidores de build prefiero la autenticación por lista blanca de IP cuando el proveedor la ofrece: si no hay contraseña en la URL, no hay nada que filtrar. <a href="https://www.flaship.com/">FlashIP</a>, por ejemplo, admite HTTP(S) y SOCKS5 con autenticación por usuario y contraseña o por lista blanca de IP, de modo que un runner de CI con IP de salida fija puede prescindir de credenciales. Si tienes que usar usuario y contraseña, guárdalos en el gestor de secretos de tu CI y pásalos con --build-arg en el momento del build.</p><h3>Diagnóstico en un minuto</h3><ul><li>Falla docker pull → configuración del daemon (o el &quot;Containers proxy&quot; de Desktop).</li><li>Falla RUN apt-get update, pero el pull funciona → ~/.docker/config.json o --build-arg.</li><li>Funciona en local pero no con un registro interno → añádelo a no-proxy / NO_PROXY.</li><li>Errores de autenticación solo con systemd → revisa el escapado con %%.</li></ul><p>Cuando aciertas con la capa correcta, la mayoría de los “Docker ignora mi proxy” se resuelven solos.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e8b2740770b8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Best Proxies for News and Media Monitoring in 2026: 8 Providers Compared]]></title>
            <link>https://medium.com/@leolin.flaship/best-proxies-for-news-and-media-monitoring-in-2026-8-providers-compared-d7e0d765f5e0?source=rss-b4ddfea2fcaa------2</link>
            <guid isPermaLink="false">https://medium.com/p/d7e0d765f5e0</guid>
            <category><![CDATA[media-monitoring]]></category>
            <category><![CDATA[proxy]]></category>
            <category><![CDATA[web-scraping]]></category>
            <dc:creator><![CDATA[Leo Lin]]></dc:creator>
            <pubDate>Tue, 24 Nov 2026 15:59:19 GMT</pubDate>
            <atom:updated>2026-11-24T15:59:19.340Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Disclosure: I’m Leo Lin, and I run FlashIP, which is ranked #2 below. Read the ranking with that in mind.</em></p><p>The same news homepage can look different depending on where you load it. Headlines, edition, language, cookie banners and paywall prompts can all change by country. If you track coverage of a brand, a policy or a product launch, one office IP gives you one edition of the story.</p><p>This ranking is for reading <strong>public</strong> headlines and article pages at a low request rate. It is not for bypassing paywalls, logging into accounts, or collecting personal data. Check each publisher’s terms and robots rules first. A proxy changes your location. It does not give you permission.</p><p>I ranked eight providers on four checks: country and city targeting, sticky sessions for paging through archives, a cheap or free way to test, and billing that suits a daily or weekly check. I read each official page today and ran no speed or block-rate benchmarks. Prices are <strong>as of November 2026</strong> and exclude VAT where the vendor says so.</p><h3>1. Decodo</h3><p>Decodo is the easiest full-featured start. Its residential pricing page lists continent, country, state, city, ZIP and ASN targeting, rotating and sticky sessions, and HTTP(S) and SOCKS5. Monthly plans run from $3.75/GB (3 GB, $11.25) to $2.75/GB (100 GB), and pay-as-you-go is $4/GB. There is a free trial and a 14-day money-back policy.</p><p><strong>Watch out for:</strong> regular plans are monthly subscriptions. The refund covers a first purchase only, with limited usage (20% of traffic on regular plans), and not if you used the 3-day trial.</p><h3>2. FlashIP (my product)</h3><p><a href="https://www.flaship.com/">FlashIP</a> sells prepaid residential traffic packages, not a monthly subscription. The pricing page lists 1 GB at $3.99, 5 GB at $3.20/GB, 10 GB at $2.80/GB, 50 GB at $2.00/GB and 100 GB at $1.60/GB. The 1,000 GB package is $999.99 in total, a displayed $1.00/GB, valid 12 months. You can select a country, state or city and either rotate per request or hold a 30, 60, 90 or 120-minute sticky session (30 by default). For a weekly headline check, the 1 GB package is a cheap first test.</p><p><strong>Watch out for:</strong> payments are final and non-refundable, including unused traffic, and unused traffic expires when the package validity ends. I did not find ZIP targeting or a public free trial on the pages I read.</p><h3>3. Rayobyte</h3><p>Rayobyte’s Premium Residential is pay-as-you-go at $3.50/GB for 1 to 49 GB and $2/GB for 50 to 249 GB. Every Premium tier lists country, city, ZIP and ASN targeting and sticky sessions. Every self-serve product has a free trial with no credit card.</p><p><strong>Watch out for:</strong> its cheapest “Scale” residential plans are monthly, open only after a compliance review, and have no targeting, so they do not suit region-by-region checks.</p><h3>4. Webshare</h3><p>Webshare’s rotating residential starts at $3.50/GB on a 1 GB plan and drops to $1.40/GB at 3,000 GB, billed monthly. The free plan (10 shared proxies, 1 GB a month, no card) is a connection test, not the residential product. A refund is possible if you cancel within 2 days and use under 0.1 GB on rotating residential.</p><p><strong>Watch out for:</strong> you pay for a month even if you only check headlines once a week. I did not find a sticky-session length on the pages I read.</p><h3>5. IPRoyal</h3><p>IPRoyal’s residential pay-as-you-go is $7.35/GB for 1 GB, $6.25/GB for 2 GB and $5.51/GB for 10 GB. Its page lists city-level targeting, sticky sessions up to 7 days and traffic that never expires, which suits irregular monitoring.</p><p><strong>Watch out for:</strong> small-volume rates are the highest in this list, and I did not see ZIP targeting listed.</p><h3>6. Bright Data</h3><p>Bright Data’s residential page lists free country, state, city and ZIP targeting, pay-as-you-go with no commitment, and monthly plans at $499, $999 and $1,999 (the $499 plan includes 141 GB). A 50% coupon was showing, so I am not quoting discounted rates as standing prices.</p><p><strong>Watch out for:</strong> those monthly plans are sized far beyond a small news-monitoring job.</p><h3>7. Oxylabs</h3><p>Oxylabs offers a $5 welcome credit and lists free geo-targeting, sticky sessions, and HTTP(S), HTTP3 and SOCKS5. Residential traffic runs through a monthly credit plan from $15/month, at $5/GB on the smallest plans down to $2/GB at 1.25K+ GB (as of November 2026).</p><p><strong>Watch out for:</strong> self-service purchases are non-refundable and unused credits expire at the end of the billing cycle. The page also lists restricted target categories on the residential network, including government websites, so confirm your sources are allowed.</p><h3>8. SOAX</h3><p>SOAX uses one rate across residential and mobile. Sandbox has no monthly fee and no included credits; Tier 1 traffic is $5.00/GB there, and Builder is $200/month. Country, region, city and ISP targeting are on every plan.</p><p><strong>Watch out for:</strong> no free trial, payments are generally non-refundable, credits expire 60 days after they are added, and ZIP targeting starts on the $1,500/month Scale plan.</p><h3>Which should you pick?</h3><p>If you want ZIP targeting and a trial before paying, start with Decodo or Rayobyte’s no-card trial. If you want a small prepaid package with no monthly subscription and country or city targeting is enough, FlashIP’s 1 GB package is the start I would use, knowing it is non-refundable and expires. If you check only now and then, compare IPRoyal’s never-expiring traffic. Whichever you choose, run one small sample first. Confirm the exit country, check that the edition matches a local reader’s view, and measure the traffic for a single page before you schedule anything.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d7e0d765f5e0" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>