Skip to content

Add support for secured http proxy #2178

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

Closed

Conversation

pderop
Copy link
Contributor

@pderop pderop commented May 7, 2022

This PR provides the ability to configure an http client proxy in secure mode.
You can now specify an ssl context in the proxy spec of the http client, and a secured channel will then be established between the client and the proxy. Then, on top of the tunnel, the client can also establish a second secured connection between itself and the remote server.

You only have to call the secure method on the proxy options, see the following example:

	SslContext proxySsl = SslContextBuilder.forClient()
			.trustManager(InsecureTrustManagerFactory.INSTANCE).build();

	Http11SslContextSpec clientSsl =
			Http11SslContextSpec.forClient()
					.configure(builder -> builder.trustManager(InsecureTrustManagerFactory.INSTANCE));

	HttpClient.create()
			.proxy(ops -> ops
					.type(ProxyProvider.Proxy.HTTP)
					.host("localhost")
					.port(proxy.port())
					.secure(spec -> spec.sslContext(proxySsl)))
			.secure(spec -> spec.sslContext(clientSsl))
			...

Fixes #2165

@pderop pderop added the type/enhancement A general enhancement label May 7, 2022
@pderop pderop added this to the 1.0.19 milestone May 7, 2022
@pderop pderop self-assigned this May 7, 2022
@pderop pderop modified the milestones: 1.0.19, 1.0.20 May 9, 2022
@pderop pderop closed this May 17, 2022
@pderop
Copy link
Contributor Author

pderop commented May 17, 2022

closed the PR, which is actually not needed.

@violetagg violetagg removed this from the 1.0.20 milestone May 17, 2022
@violetagg violetagg removed the type/enhancement A general enhancement label May 17, 2022
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

Successfully merging this pull request may close these issues.

2 participants