zk-123 / http-proxy Goto Github PK
View Code? Open in Web Editor NEWhttp proxy
License: MIT License
http proxy
License: MIT License
楼主你好,我想在现有代码部署在国内,然后加一个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都无法正常访问,楼主可否给一些建议?十分感谢
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
我有两个疑问:
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.