Skip to content

ProxyAgent support proxy as URL #2278

Closed

Description

@PandaWorker

why not add proxy support as a URL?

import { env } from "./env.mjs";
import { ProxyAgent } from "undici";

// env.PROXY_URL = 'http://username:password@ip:port';
const proxy = new URL(env.PROXY_URL);

// WORK
export const proxyAgent = new ProxyAgent({
    uri: proxy.origin + proxy.pathname,
    token: `Basic ${Buffer.from(`${proxy.username}:${proxy.password}`).toString('base64')}`,
});

// DONT WORK
export const proxyAgent2 = new ProxyAgent(proxy);

Activity

  1. Ethan-Arrowood commented on Sep 21, 2023

    @Ethan-Arrowood
    Collaborator

    I'm open to supporting both. But let's make sure it doesn't impact performance for the ProxyAgent instantiation.

  2. metcoder95 commented on Sep 21, 2023

    @metcoder95
  3. PandaWorker commented on Sep 21, 2023

    @PandaWorker
    ContributorAuthor

    99% of proxies use basic authorization. This won't affect anything. Through the parameters it will be possible to specify an explicit authorization type, if it is not basic

  4. metcoder95 commented on Sep 21, 2023

    @metcoder95
    Member

    Hmm, never mind, I take back what I said; I read the deprecation wrongly. Basically is just about deprecating property auth in favour of token (sorry about that).

    Then, no issue at all; then SGTM adding support for object URL support

  5. rossilor95 commented on Mar 1, 2024

    @rossilor95
    Contributor

    Since #2810 has been merged, can this be closed?

  6. Uzlopak commented on Mar 1, 2024

    @Uzlopak
    Contributor

    Yep

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions