Comments (9)
Also, I need to avoid roundtrips (407 & 401 errors). To do so in apache there is a concept of PreemptiveAuthentication. Is there any similar concept to this in netty? If yes, could you please help me in configuring the same.
from reactor-netty.
@SushmaPradeep I'm looking at netty/netty#13892, there is no need to open duplicate issues!
from reactor-netty.
@SushmaPradeep I am seeing that a request like this is sent.
17:23:58.216 [reactor-http-nio-1] DEBUG reactor.netty.proxy - [fd907a4e, L:/127.0.0.1:56744 - R:localhost/127.0.0.1:3128] WRITE, DefaultFullHttpRequest(decodeResult: success, version: HTTP/1.1, content: EmptyByteBufBE)
CONNECT example.com:443 HTTP/1.1
host: example.com:443
proxy-authorization: Basic <filter>
Can you please elaborate more on the issue? Can you provide either logs or tcp dump?
from reactor-netty.
Thanks for quick responses @violetagg .
Yes, Iām also seeing this proxy_authorization in client side request context but not in outboundheaders or request object. Also, it is sending only scheme(basic) and not the encoded credentials. And this authorization value is not available in server side.
As I said I need to achieve preemptive authentication concept to avoid 407 roundtrips which is available with apache httpclient.
Could you please redirect me to the correct route to configure and achieve the same.
from reactor-netty.
I have squid
proxy configured with u/p.
I have this application:
public class Application {
public static void main(String[] args) {
HttpClient client =
HttpClient.create()
.wiretap(true)
.proxy(spec -> spec.type(ProxyProvider.Proxy.HTTP)
.host("localhost")
.port(3128)
.username("test")
.password(u -> "test"));
String response =
client.get()
.uri("https://example.com/")
.responseContent()
.aggregate()
.asString()
.block();
System.out.println("Response " + response);
}
}
When I'm executing this application I'm seeing a successful communication:
...
20:24:45.157 [reactor-http-nio-1] DEBUG reactor.netty.proxy - [c482d8cf] REGISTERED
...
20:24:45.160 [reactor-http-nio-1] DEBUG reactor.netty.proxy - [c482d8cf] CONNECT: localhost/127.0.0.1:3128
...
20:24:45.162 [reactor-http-nio-1] DEBUG reactor.netty.proxy - [c482d8cf, L:/127.0.0.1:58043 - R:localhost/127.0.0.1:3128] ACTIVE
20:24:45.165 [reactor-http-nio-1] DEBUG reactor.netty.proxy - [c482d8cf, L:/127.0.0.1:58043 - R:localhost/127.0.0.1:3128] WRITE, DefaultFullHttpRequest(decodeResult: success, version: HTTP/1.1, content: EmptyByteBufBE)
CONNECT example.com:443 HTTP/1.1
host: example.com:443
proxy-authorization: Basic dGVzdDp0ZXN0, 0B
20:24:45.167 [reactor-http-nio-1] DEBUG reactor.netty.proxy - [c482d8cf, L:/127.0.0.1:58043 - R:localhost/127.0.0.1:3128] FLUSH
...
20:24:45.321 [reactor-http-nio-1] DEBUG reactor.netty.proxy - [c482d8cf, L:/127.0.0.1:58043 - R:localhost/127.0.0.1:3128] READ: DefaultHttpResponse(decodeResult: success, version: HTTP/1.1)
HTTP/1.1 200 Connection established
20:24:45.321 [reactor-http-nio-1] DEBUG reactor.netty.proxy - [c482d8cf, L:/127.0.0.1:58043 - R:localhost/127.0.0.1:3128] READ, EmptyLastHttpContent, 0B
...
I'm not seeing any 407
error.
from reactor-netty.
@SushmaPradeep I'm closing this one. We can reopen it if it is needed.
from reactor-netty.
@violetagg Could you please re-open the issue. I'm using Hoverfly as proxy server. And I can't see proxy-authorization header.
Please find the below logs:
request={body=, destination=localhost:8094, headers={Accept=[text/plain, application/json, application/*+json, /], Accept-Encoding=[gzip, x-gzip, deflate], B3=[65dc9b4f308cd1148f70dd79c23841f2-c339dd05d8e4e80e-0], Content-Length=[0], User-Agent=[Apache-HttpClient/5.2.3 (Java/17.0.10)]}, method=GET, path=/api/v1/message, query={}, scheme=http}
from reactor-netty.
@SushmaPradeep The user agent in this request is not Reactor Netty?
User-Agent=[Apache-HttpClient/5.2.3 (Java/17.0.10)]
from reactor-netty.
Reactor Netty HttpClient
uses always CONNECT
method for proxy.
I installed Hoverfly
and executed a request successful.
The application from above, just the port for the proxy is 8500.
11:41:18.290 [reactor-http-nio-1] DEBUG reactor.netty.proxy - [17856b23] REGISTERED
...
11:41:18.292 [reactor-http-nio-1] DEBUG reactor.netty.proxy - [17856b23] CONNECT: localhost/127.0.0.1:8500
...
11:41:18.294 [reactor-http-nio-1] DEBUG reactor.netty.proxy - [17856b23, L:/127.0.0.1:64037 - R:localhost/127.0.0.1:8500] ACTIVE
11:41:18.297 [reactor-http-nio-1] DEBUG reactor.netty.proxy - [17856b23, L:/127.0.0.1:64037 - R:localhost/127.0.0.1:8500] WRITE, DefaultFullHttpRequest(decodeResult: success, version: HTTP/1.1, content: EmptyByteBufBE)
CONNECT example.com:443 HTTP/1.1
host: example.com:443
proxy-authorization: Basic dGVzdDp0ZXN0, 0B
11:41:18.300 [reactor-http-nio-1] DEBUG reactor.netty.proxy - [17856b23, L:/127.0.0.1:64037 - R:localhost/127.0.0.1:8500] FLUSH
...
11:41:18.403 [reactor-http-nio-1] DEBUG reactor.netty.proxy - [17856b23, L:/127.0.0.1:64037 - R:localhost/127.0.0.1:8500] READ: DefaultHttpResponse(decodeResult: success, version: HTTP/1.0)
HTTP/1.0 200 OK
11:41:18.403 [reactor-http-nio-1] DEBUG reactor.netty.proxy - [17856b23, L:/127.0.0.1:64037 - R:localhost/127.0.0.1:8500] READ, EmptyLastHttpContent, 0B
from reactor-netty.
Related Issues (20)
- non-blocking call delayed accasionally. HOT 2
- Webclient timeout with Httpclient HOT 10
- Support SocketAddress for proxies HOT 2
- Support for changing the default compression level when enabling server response compression HOT 3
- Added configuration to disable dns using TransportConnector HOT 5
- The premature closure of a TCP connection, resulting in the error "Connection prematurely closed BEFORE response," affects another connection. HOT 3
- Need proper documentation for Default ConnectionPool and LoopResource usage with different hosts and/or port HOT 1
- Webclient active connection is struck - Direct buffer memory increase HOT 16
- MonoSend MAX_SIZE and REFILL_SIZE are not configurable HOT 6
- Netty does not provide errorLog just accesLog HOT 1
- http3 Error: connect ECONNREFUSED HOT 3
- Connection prematurely closed BEFORE response Internal timeout HOT 2
- HttpClient.reactorNettyVersion() throws NullPointException when loaded through -javaagent, under jdk 1.8
- The connection observed an error reactor.netty.channel.AbortedException: Connection has been closed HOT 12
- Memory Leak Detected in Netty 4.1.100.Final HOT 7
- io.netty.channel.unix.Errors$NativeIoException: readAddress(..) failed: Connection reset by peer HOT 2
- ReadTimeoutException with WebClient During Low Traffic Periods Despite Configuring maxIdleTime HOT 5
- Internal state of HttpObjectDecoder is not reset when connection pooling is used HOT 3
- Content-Length set for GET/HEAD requests HOT 1
- WebSocket aggregation FrameTooLargeException handling doesn't close connection
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
š Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ā¤ļø Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from reactor-netty.