Using a proxy / agent option is ignored
Opened this issue · 3 comments
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.
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.
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.
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.