Jetty ProxyServlet with SSL support

前端 未结 3 1414
一个人的身影
一个人的身影 2020-12-09 22:06

I am using Jetty\'s ProxyServlet as a HTTP proxy.

After I start the server and add the socks proxy in firefox I can access websites through the proxy without any pro

3条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-09 22:26

    ZmK's answer is simply a copy of the example from Jetty repositories and does not even work.

    Jetty by default does not have an HTTPS Proxy. The AsyncProxyServlet and ProxyServlet classes only do HTTP proxy. In order for you to do an HTTPS proxy, do the following:

    1. Create a class which extends from AsyncProxyServlet class.
    2. Override createHttpClient() method. The key here is that the HttpClient instance which you will create will need an SslContextFactory(). Just set SslContextFactory with appropriate settings on HttpClient object and you will be good to go.

    Here is the code example in detail: https://github.com/k2k2e6/jettyHttpsProxy

提交回复
热议问题