zregvart / camel-netty-proxy

Camel Netty Proxy example
Apache License 2.0
7 stars 12 forks source link

Running the example in the README does not work #3

Closed pimg closed 4 years ago

pimg commented 4 years ago

When running the example on the README: docker build -t camel-netty-proxy . docker run --rm -p 8080:8080 camel-netty-proxy http_proxy=http://localhost:8080 curl -v https://echo-api.3scale.net

the HTTP request does not go through the proxy, when configuring the proxy in curl like this: curl -x http://localhost:8080 https://echo-api.3scale.net the following response is returned: curl: (56) Proxy CONNECT aborted

The Camel context + route are started normally, the output of stdout: $ docker run --rm -p 8080:8080 camel-netty-proxy 2019-12-04 14:49:59 [main] INFO o.apache.camel.main.BaseMainSupport - Using properties from classpath:application.properties 2019-12-04 14:49:59 [main] INFO o.a.c.main.DefaultRoutesCollector - Loading additional Camel XML routes from: classpath:camel/.xml 2019-12-04 14:49:59 [main] INFO o.a.c.main.DefaultRoutesCollector - Loading additional Camel XML rests from: classpath:camel-rest/.xml 2019-12-04 14:49:59 [main] INFO o.a.camel.impl.DefaultCamelContext - Apache Camel 3.0.0-RC3 (CamelContext: camel-1) is starting 2019-12-04 14:49:59 [main] INFO o.a.c.i.e.DefaultManagementStrategy - JMX is disabled 2019-12-04 14:49:59 [main] INFO o.a.camel.impl.DefaultCamelContext - StreamCaching is not in use. If using streams then its recommended to enable stream caching. See more details at http://camel.apache.org/stream-caching.html 2019-12-04 14:49:59 [main] INFO o.a.c.c.n.h.HttpServerBootstrapFactory - BootstrapFactory on port 8080 is using bootstrap configuration: [NettyServerBootstrapConfiguration{protocol='proxy', host='0.0.0.0', port=8080, broadcast=false, sendBufferSize=65536, receiveBufferSize=65536, receiveBufferSizePredictor=0, workerCount=0, bossCount=1, keepAlive=true, tcpNoDelay=true, reuseAddress=true, connectTimeout=10000, backlog=0, serverInitializerFactory=org.apache.camel.component.netty.http.HttpServerInitializerFactory@9816741, nettyServerBootstrapFactory=null, options=null, ssl=false, sslHandler=null, sslContextParameters='null', needClientAuth=false, enabledProtocols='TLSv1,TLSv1.1,TLSv1.2, keyStoreFile=null, trustStoreFile=null, keyStoreResource='null', trustStoreResource='null', keyStoreFormat='JKS', securityProvider='SunX509', passphrase='null', bossGroup=null, workerGroup=null, networkInterface='null', reconnect='true', reconnectInterval='10000'}] 2019-12-04 14:49:59 [main] INFO o.a.c.c.n.SingleTCPNettyServerBootstrapFactory - ServerBootstrap binding to 0.0.0.0:8080 2019-12-04 14:49:59 [main] INFO o.a.c.c.netty.http.NettyHttpConsumer - Netty consumer bound to: 0.0.0.0:8080 2019-12-04 14:49:59 [main] INFO o.a.camel.impl.DefaultCamelContext - Route: route1 started and consuming from: proxy://0.0.0.0:8080 2019-12-04 14:49:59 [main] INFO o.a.camel.impl.DefaultCamelContext - Total 1 routes, of which 1 are started 2019-12-04 14:49:59 [main] INFO o.a.camel.impl.DefaultCamelContext - Apache Camel 3.0.0-RC3 (CamelContext: camel-1) started in 0.378 seconds

I also tested it with by exporting the ENV var http_proxy and HTTP_PROXY but the results are the same.

I am running on Fedora 31.

pimg commented 4 years ago

nevermind, it works with HTTP and not with HTTPS since the proxy is not using TLS.