Skip to content

ProxyAgent support proxy as URL #2278

@PandaWorker

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);

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