A high-performance HTTP proxy service built on Quarkus that tracks and records external resource accesses during builds for non-Maven, non-NPM files. The service automatically creates Artifactory remote repositories based on external URLs and ensures all external dependencies are properly tracked and cached, preventing loss of build dependency information.
The service is built with a modular architecture:
- Core Proxy Engine: XNIO-based async HTTP proxy server (
HttpProxy.java) - Request Handlers:
ProxyAcceptHandlermanages incoming connections and routing - MITM SSL Support:
ProxyMITMSSLServerenables SSL interception and certificate generation - Repository Integration: REST client services for Artifactory repository management
- Authentication: Keycloak integration with bearer token support
- Observability: OpenTelemetry tracing and metrics
- Build Dependency Tracking: Records all external resource accesses during builds with build ID association
- Automatic Repository Creation: Dynamically creates Artifactory remote repositories based on external host URLs
- MITM SSL Proxy: Intercept and proxy HTTPS traffic with custom CA certificates for complete tracking
- Content Caching: Intelligent caching with configurable storage strategies to avoid duplicate downloads
- Repository Management: Dynamic repository creation and content retrieval via Artifactory API
- Authentication: Keycloak OIDC integration with configurable security
- High Performance: Async I/O with configurable worker threads and connection pooling
- Observability: Built-in OpenTelemetry tracing and Prometheus metrics
- Runtime: Quarkus 3.38.1 with Java 25
- I/O: XNIO 3.8.17.Final for high-performance async networking
- HTTP Client: OkHttp 4.12.0 for repository communication
- Repository Client: Artifactory Java Client 2.21.3
- Authentication: Keycloak for OIDC/OAuth2
- Observability: OpenTelemetry SDK with OTLP export
- Caching: Caffeine cache with configurable eviction
- JDK 25+
- Maven 3.9.11+
- Running Artifactory instance (for repository operations)
Key configuration options in application.yaml:
proxy:
port: 8082 # Proxy server port
secured: true # Enable authentication
worker:
io.threads: 10 # I/O worker threads
task.threads: 10 # Task worker threads
MITM:
enabled: true # Enable MITM SSL
ca.key: /tmp/ssl/ca.key # CA private key (supports PEM or DER format)
ca.cert: /tmp/ssl/ca.crt # CA certificate (supports PEM or DER format)
artifactory:
url: http://localhost:8081/artifactory
access-token: ${ARTIFACTORY_ACCESS_TOKEN}
project-key: NCLThe proxy supports both PEM and DER formats for CA certificates and private keys:
- Private Key: Accepts
.pem,.key(PEM format) or.der(DER format) - Certificate: Accepts
.pem,.crt(PEM format) or.der(DER format)
Format detection is automatic - the code detects PEM format by checking for the -----BEGIN header.
Example PEM files:
# Generate PEM format CA key and certificate
openssl genpkey -algorithm RSA -pkeyopt rsa_keygen_bits:2048 -out ca.key
openssl req -new -x509 -days 3600 -key ca.key -subj "/CN=Test CA/O=Test Org" -out ca.crtExample DER files (legacy format):
# Convert PEM to DER format
openssl pkcs8 -topk8 -outform DER -in ca.key -out ca.der -nocryptThe proxy service solves the problem of lost dependency tracking in non-Maven/non-NPM builds by intercepting all external resource requests:
- Client Request: Build process sends HTTP/HTTPS request to external resource
- Proxy Interception: Request is intercepted by the proxy service
- Build ID Association: External URL is recorded and associated with the current build ID
- Repository Check: Proxy checks if an Artifactory remote repository exists for the external host
- Repository Creation: If not found, automatically creates a new remote repository for the host
- Content Retrieval: Fetches the resource from the external URL
- Content Storage: Stores the content in the appropriate Artifactory repository
- Response: Returns the content to the client
- Complete Dependency Tracking: No external resource access goes unrecorded
- Automatic Repository Management: No manual repository configuration needed
- Build Reproducibility: All dependencies are cached and versioned
- Security: MITM SSL support ensures even HTTPS resources are tracked
- Performance: Intelligent caching reduces duplicate downloads
- Build the project:
git clone https://github.com/project-ncl/generic-http-proxy.git
cd generic-http-proxy
mvn clean compile- Configure Artifactory connection in
application.yaml:
artifactory:
url: http://localhost:8081/artifactory
access-token: ${ARTIFACTORY_ACCESS_TOKEN}
project-key: NCL- Start in development mode:
mvn quarkus:dev- Configure your build environment to use the proxy:
export http_proxy=http://localhost:8082
export https_proxy=http://localhost:8082
# For builds that support proxy configuration- Run your build - all external resource accesses will be automatically tracked and cached
HttpProxy: Main application class that starts the XNIO-based proxy serverProxyAcceptHandler: Handles incoming connections and manages the tracking workflowProxyMITMSSLServer: Manages SSL interception and certificate generation for HTTPS trackingArtifactoryRemoteRepositoryManager: Manages Artifactory repository operations and automatic repository creationArtifactoryContentService: Handles content retrieval, caching, and build ID associationArtifactoryProxyResponseHelper: Manages the complete tracking workflow from request to response
Run the test suite:
mvn testThe project includes comprehensive tests for proxy functionality, SSL handling, and repository integration.
Multiple Dockerfile variants are available:
Dockerfile.jvm: Standard JVM deploymentDockerfile.native: Native compilation with GraalVMDockerfile.native-distroless: Minimal distroless image
The service exposes:
- Health checks at
/q/health - Metrics at
/q/metrics(Prometheus format) - OpenTelemetry traces (configurable endpoints)
- Configure proper CA certificates for MITM functionality
- Set up Keycloak authentication for production
- Monitor proxy logs for security events