Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[jetty-users] HTTPS and ProxyServlet

Hi,
I'm using Jetty 9.3.5, and take advantage of ProxyServlet as a tunnel proxy.
Please consider the following test codes,

********************************
SslContextFactory sslContextFactory = new SslContextFactory();
sslContextFactory.setSslContext(sslContext);

HttpClient client = new HttpClient(sslContextFactory);
client.getProxyConfiguration().getProxies().add(new HttpProxy(new Origin.Address(host, port), true));
client.start();

String url = "">ContentResponse response = client.newRequest(url).send();
System.out.println(response.getContentAsString());
client.stop();
********************************

If the url is HTTP path, it works well.But if the url is HTTPS path, say, https://host:sslPort/xxx, it reports 404 error.
The exception shows some message, like
org.eclipse.jetty.client.HttpResponseException: Received HttpResponse[HTTP/1.1 404 Not Found]@1aed4133 for HttpRequest[CONNECT host:sslPort HTTP/1.1]@5b1d67b3

I have set SSL context for the client. What is missing?

Thanks!

Back to the top