Git Product home page Git Product logo

Comments (9)

SushmaPradeep avatar SushmaPradeep commented on June 13, 2024

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.

violetagg avatar violetagg commented on June 13, 2024

@SushmaPradeep I'm looking at netty/netty#13892, there is no need to open duplicate issues!

from reactor-netty.

violetagg avatar violetagg commented on June 13, 2024

@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.

SushmaPradeep avatar SushmaPradeep commented on June 13, 2024

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.

violetagg avatar violetagg commented on June 13, 2024

@SushmaPradeep

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.

violetagg avatar violetagg commented on June 13, 2024

@SushmaPradeep I'm closing this one. We can reopen it if it is needed.

from reactor-netty.

SushmaPradeep avatar SushmaPradeep commented on June 13, 2024

@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.

violetagg avatar violetagg commented on June 13, 2024

@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.

violetagg avatar violetagg commented on June 13, 2024

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)

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.