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

Support for HTTP proxy with authentication #661

Open
shantanu1singh opened this issue Sep 16, 2020 · 3 comments
Open

Support for HTTP proxy with authentication #661

shantanu1singh opened this issue Sep 16, 2020 · 3 comments

Comments

@shantanu1singh
Copy link

Question: Does the library have support for HTTP proxies with authentication using the mqtt_tls_client_ws() API?

For example, the Paho Mqtt library supports HTTP proxies with authentication: eclipse-paho/paho.mqtt.c#542 (comment)

@redboltz
Copy link
Owner

No. I'm not sure but it seems that Boost.Beast doesn't support it so mqtt_cpp doesn't support it.

You can use the command proxytunnel.
https://github.com/proxytunnel/proxytunnel
It supports authentication.

proxytunnel -p proxy.sever:port -d target.host:port -a localport

for example,

proxytunnel -p proxy.yourdomain:8080 -d target.host:443 -a 10000

You can connect using 127.0.0.1:10000.

@shantanu1singh
Copy link
Author

ah, I see. Interesting, thanks for the link. I'll take a look

@ashbeitz
Copy link

ashbeitz commented May 4, 2021

I have made changes to my local copy of the repo to allow mqtt_cpp to support proxy servers. The footprint for my changes is relatively small - a new method was added to tcp_endpoint.cpp and ws_enpoint.cpp to find the lowest stream layer, and client.cpp has setters for the the proxy details and the connect_impl methods were changed to establish a TCP tunnel through the proxy server.

I have tested this using the proxy server called Squid and the results are good. Also, the changes do not break any of the existing system tests or unit tests. I don't think that I can easily add new system tests for this, as they would require a live proxy server.

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

3 participants