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

How to proxy HTTP/2 via a HTTP proxy using got #1265

Closed
swang2019 opened this issue May 14, 2020 · 7 comments
Closed

How to proxy HTTP/2 via a HTTP proxy using got #1265

swang2019 opened this issue May 14, 2020 · 7 comments

Comments

@swang2019
Copy link

tried to do :

        http2: tunnel.http(s)OverHttp({
            proxy: {
                host: 'localhost',
                port: 6767
            }
        }),

received runtime error:

(node:60026) UnhandledPromiseRejectionWarning: RequestError: The "listener" argument must be of type function. Received an instance of Object

any ideas ?

@szmarczak
Copy link
Collaborator

The http2 Agent is not the http.Agent. It's this: https://github.com/szmarczak/http2-wrapper/#new-http2agentoptions

I'm not sure how you can proxy it for now.

@swang2019
Copy link
Author

The http2 Agent is not the http.Agent. It's this: https://github.com/szmarczak/http2-wrapper/#new-http2agentoptions

I'm not sure how you can proxy it for now.

that's sad. I need both http/2 and proxy to be functional, and I do not know how to do this...

@yovanoc
Copy link

yovanoc commented Jun 12, 2020

I'm trying to do the same... @swang2019 did you find something?

@swang2019
Copy link
Author

swang2019 commented Jun 12, 2020 via email

@SwiTool
Copy link

SwiTool commented Jun 12, 2020

Is HTTP/2 proxy support planned for the near future?

Short answer:

No, there are no plans.

Long answer:

There is almost no sense to implement it, as the main HTTP/2 benefit is that it allows multiplexing many requests within a single connection, thus [almost] removing the limit on number of simalteneous requests - and there is no such limit when talking to your own backends. Moreover, things may even become worse when using HTTP/2 to backends, due to single TCP connection being used instead of multiple ones.

On the other hand, implementing HTTP/2 protocol and request multiplexing within a single connection in the upstream module will require major changes to the upstream module.

Due to the above, there are no plans to implement HTTP/2 support in the upstream module, at least in the foreseeable future. If you still think that talking to backends via HTTP/2 is something needed - feel free to provide patches.

I don't know if it's reliable but i'll still link that

source: https://stackoverflow.com/a/41647983

@szmarczak
Copy link
Collaborator

@swang2019
Copy link
Author

swang2019 commented Jul 11, 2020

https://github.com/szmarczak/http2-wrapper#proxy-support Make sure you're using [email protected]

fantastic job, thanks! though we switched to node-libcurl before the solution is out.. will check in our next project.

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

4 participants