Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ProxyAgent support proxy as URL #2278

Closed
PandaWorker opened this issue Sep 21, 2023 · 6 comments
Closed

ProxyAgent support proxy as URL #2278

PandaWorker opened this issue Sep 21, 2023 · 6 comments
Labels
enhancement New feature or request

Comments

@PandaWorker
Copy link

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);
@PandaWorker PandaWorker added the enhancement New feature or request label Sep 21, 2023
@Ethan-Arrowood
Copy link
Collaborator

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

@metcoder95

This comment was marked as outdated.

@PandaWorker
Copy link
Author

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

@metcoder95
Copy link
Member

metcoder95 commented Sep 21, 2023

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

@rossilor95
Copy link
Contributor

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

@Uzlopak
Copy link
Contributor

Uzlopak commented Mar 1, 2024

Yep

@Uzlopak Uzlopak closed this as completed Mar 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants