Coder Social home page Coder Social logo

http-proxy's People

Contributors

dependabot[bot] avatar zk-123 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

http-proxy's Issues

在现有代码上再加一个国外代理

楼主你好,我想在现有代码部署在国内,然后加一个vpn访问境外的网站,代码如下:
`private ChannelFuture connectRemote(InetSocketAddress dstAddress, final ChannelHandler... channelHandlers) {
if (remoteBootstrap == null) {
remoteBootstrap = new Bootstrap();
}

	return remoteBootstrap.group(clientChannel.eventLoop()).option(ChannelOption.SO_KEEPALIVE, true).option(ChannelOption.TCP_NODELAY, true)
			.option(ChannelOption.CONNECT_TIMEOUT_MILLIS, (int) serverConfigure.getTimeout()).channel(NioSocketChannel.class)
			.handler(new ChannelInitializer<Channel>() {
				protected void initChannel(Channel ch) {
					for (ChannelHandler channelHandler : channelHandlers) {
						ch.pipeline().addLast(channelHandler);
					}
					// 绑定境外代理
					InetSocketAddress proxy = new InetSocketAddress("代理IP", 代理端口);
					ch.pipeline().addFirst(new HttpProxyHandler(proxy));
				}
			}).connect(dstAddress);
}`

如上所示,我在创建远程连接时候添加上了HttpProxyHandler,但是只有部分网站能够正常访问,比如stackoverflow、youtube,但是twitter、facebook都无法正常访问,楼主可否给一些建议?十分感谢

TLS handshake failure

HTTPS 请求直接连接代理服务器时,出现错误。HttpRequestDecoder 不能正确处理请求。

DefaultFullHttpRequest(decodeResult: failure(java.lang.IllegalArgumentException: text is empty (possibly HTTP/0.9)), version: HTTP/1.0, content: UnpooledByteBufAllocator$InstrumentedUnpooledUnsafeHeapByteBuf(ridx: 0, widx: 0, cap: 0))

使用 curl 可以重现该问题。

curl https://baidu.com --proxy https:http://localhost:2781 -v

详细的日志如下:

*   Trying ::1...
* TCP_NODELAY set
* Connected to localhost (::1) port 2781 (#0)
* ALPN, offering http/1.1
* successfully set certificate verify locations:
*   CAfile: /etc/ssl/cert.pem
  CApath: none
* TLSv1.2 (OUT), TLS handshake, Client hello (1):
* LibreSSL SSL_connect: SSL_ERROR_SYSCALL in connection to localhost:2781
* Closing connection 0
curl: (35) LibreSSL SSL_connect: SSL_ERROR_SYSCALL in connection to localhost:2781

我有两个疑问:

  • 对于 HTTPS 请求,难道一定要解包后才行?
  • HTTPS 不是所有的数据都加密,HttpRequestDecoder 应该可以解析出请求头?但目前解析是失败的。(对于代理服务的话,能解析到请求头就够了)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.