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

Using a proxy / agent option is ignored #142

Open
janus-reith opened this issue Dec 9, 2020 · 3 comments
Open

Using a proxy / agent option is ignored #142

janus-reith opened this issue Dec 9, 2020 · 3 comments

Comments

@janus-reith
Copy link

Using popsicle.fetch the agent option seems to be ignored.

I'm unable to use a proxy with popsicle for that reason, passing agent e.g. to node-fetch works fine.
popsicle-proxy-agent which is deprecated and uses a function createTransport which doesn't seem to exist anymore also suggests just passing agent now.

I tried looking at the code of both toFetch and serviejs but got no clue how to accomplish this.

@blakeembrey
Copy link
Member

blakeembrey commented Dec 9, 2020

There isn’t any agent option for the fetch function - only things documented in the README. The agent isn’t supported because popsicle uses HTTP2 where possible by default, which doesn’t support HTTP agents. It’s also the reason for deprecating the middleware unfortunately.

One possibility is we add it to https://github.com/serviejs/popsicle-transport-http or revive the plugin you mentioned and it’ll only support HTTP1 for now. I’m actually not entirely sure how to proxy over HTTP2 which is why I haven’t build a generic utility again. Would HTTP1 only be acceptable for now?

Edit: Looking into how the proxy is implemented, I should be able to add proxying with HTTP2 support. I can make an attempt this week or weekend.

@janus-reith
Copy link
Author

Thanks for the quick response, and thanks for looking into it!
For my specific usecase HTTP1 would probably be fine, I‘m expecting larger bottlenecks on other levels.

Let me know if I can help in any way.

@blakeembrey
Copy link
Member

I fell way behind on this but made good progress this weekend. I've refactored some of the underlying HTTP transport in node.js to accept socket creation asynchronously (mostly in serviejs/popsicle-transport-http@b31ab39). With this in place I can release a new major version and add support for HTTP proxies via a configuration option that just returns a proxy asynchronously. I'll look at creating that plugin this week.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants