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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support using undici behind a proxy server #159

Closed
omardoma opened this issue Mar 30, 2021 · 2 comments 路 Fixed by #363
Closed

Support using undici behind a proxy server #159

omardoma opened this issue Mar 30, 2021 · 2 comments 路 Fixed by #363

Comments

@omardoma
Copy link

omardoma commented Mar 30, 2021

馃殌 Feature Proposal

Add a field in undici options that specifies the proxy you need to connect to before forwarding the request to the upstream.

Motivation

Right now the only way to use the plugin behind a proxy server is to not use undici and instead use http while passing the agents option:

const ReplyFrom = require('fastify-reply-from');
const proxy = require('proxy-agent');
fastify.register(ReplyFrom, {
  http: {
     agents: {
       "http:": proxy('url'),
       "https:": proxy('url')
     }
  }
});

Recently undici has added support for proxies as mentioned in its documentation, so it would be great if we can support passing the proxy field as part of undici's options and not have to switch to http.

Example

const ReplyFrom = require('fastify-reply-from');
fastify.register(ReplyFrom, {
  unidici: {
    proxy: 'http://username:password@proxyIp:proxyPort'
  }
});
@mcollina
Copy link
Member

This would be amazing!
Would you like to send a Pull Request to address this issue? Remember to add unit tests.

@omardoma
Copy link
Author

Sure, will send it soon!

@omardoma omardoma changed the title Support using unidici behind a proxy server Support using undici behind a proxy server Apr 13, 2021
mcollina pushed a commit that referenced this issue Apr 22, 2024
Closes #159

Signed-off-by: Jamie King <jamie.king@aexp.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants