Skip to content

zregvart/camel-netty-proxy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

d6e2873 · Nov 17, 2020

History

33 Commits
Apr 14, 2020
Nov 17, 2020
Oct 27, 2020
Oct 27, 2020
Apr 23, 2020
Oct 27, 2020
Jun 21, 2019
Apr 14, 2020
Jun 24, 2019
Jun 24, 2019
Oct 27, 2020
Jul 21, 2019

Docker Repository on Quay Docker Repository on Docker Hub CircleCI

Camel Netty Proxy example

This is an example of using the Apache Camel integration framework to create a HTTP proxy using the Camel Netty component.

Any request that is received using the HTTP PROXY protocol, i.e specifying the absolute form for the request target will be forwarded to the target service with the HTTP body converted to uppercase. The response from the target service will be processed by converting it to uppercase and returned to the client.

The support for HTTP over TLS (https) protocol is available if Java Keystore file is mounted at /tls/keystore.jks (with password changeit). The implementation doesn't support HTTPS proxy tunneling via CONNECT, the request needs to be issued same as it is issued for the HTTP PROXY, the only added benefit is that the request can be made over TLS.

If /tls/keystore.jks exists then the listening port changes to 8443.

Building and running

To build the Docker image execute:

$ docker build -t camel-netty-proxy .

To run the Docker image execute:

$ docker run --rm -p 8080:8080 camel-netty-proxy

To test using curl set the http_proxy environment variable, for example:

$ http_proxy=http://localhost:8080 curl -v http://neverssl.com

Running on OpenShift

To run on openshift, log in via the oc login command to the OpenShift cluster and position yourself in the project of choice using oc project <project> and run:

$ ./mvnw -Popenshift package

When running on OpenShift the service listens on port 8443 with TLS enabled. The certificate is issued by the OpenShift CA.