Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Apache http core nio 4.3.3 reverse proxy SSL error

I am developing a reverse proxy using http core nio 4.3.3 and need to connect to a Secure/HTTPS endpoint via the proxy. I took the reverse proxy(Asynchronous HTTP reverse proxy)[1] and added SSL support as shown below.

    SSLContext clientSSLContext =
                       SSLUtil.createClientSSLContext(TRUST_STORE_LOCATION,
                                                      TRUST_STORE_PASSWORD);

    final IOEventDispatch connectingEventDispatch =
                                                    new DefaultHttpClientIODispatch(
                                                                                    clientHandler,
                                                                                    clientSSLContext,
                                                                                    ConnectionConfig.DEFAULT);
    ...
    connectingIOReactor.execute(connectingEventDispatch);

When I send the request, I am getting this error,

java.io.IOException: SSL not supported

The Stack trace is given below.

[client<-proxy] 00000001 java.io.IOException: SSL not supported java.io.IOException: SSL not supported at org.apache.http.impl.nio.pool.BasicNIOConnFactory.create(BasicNIOConnFactory.java:159) at org.apache.http.impl.nio.pool.BasicNIOConnFactory.create(BasicNIOConnFactory.java:1) at org.apache.http.nio.pool.AbstractNIOConnPool.requestCompleted(AbstractNIOConnPool.java:484) at org.apache.http.nio.pool.AbstractNIOConnPool$InternalSessionRequestCallback.completed(AbstractNIOConnPool.java:770) at org.apache.http.impl.nio.reactor.SessionRequestImpl.completed(SessionRequestImpl.java:127) at org.apache.http.impl.nio.reactor.AbstractIOReactor.processNewChannels(AbstractIOReactor.java:423) at org.apache.http.impl.nio.reactor.AbstractIOReactor.execute(AbstractIOReactor.java:288) at org.apache.http.impl.nio.reactor.BaseIOReactor.execute(BaseIOReactor.java:105) at org.apache.http.impl.nio.reactor.AbstractMultiworkerIOReactor$Worker.run(AbstractMultiworkerIOReactor.java:586) at java.lang.Thread.run(Thread.java:662)

I enabled SSL debug logs as well, but still could not figure out the issue. Then I debugged this and found out that the proxy received the request from the client and drops due to an exception inside the handle method of HttpAsyncRequestConsumer. The exception is java.io.IOException: SSL not supported

Also note that the SSLContext was working fine with a reverse proxy written using the netty transport.

Any help would be appreciated.

[1] https://hc.apache.org/httpcomponents-core-ga/examples.html

Regards, Ravindra.

like image 447
Ravindra Ranwala Avatar asked Sep 15 '26 07:09

Ravindra Ranwala


1 Answers

When using a connection pool on the client side to manage outgoing connections one needs to ensure that the connection factory used by the pool to create new connection objects is SSL capable. Please make sure that the connection pool is properly configured.

like image 146
ok2c Avatar answered Sep 19 '26 02:09

ok2c



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!