Skip to content

Outbound proxy support for air-gapped / corporate network environments #83

@coopernetes

Description

@coopernetes

Summary

In many organisations, servers don't have direct internet access — outbound connections must go through a corporate HTTP proxy. jgit-proxy currently assumes direct internet access when forwarding to upstream SCM providers. There's no way to configure an outbound proxy, making the proxy unusable in these environments.

Three outbound connection paths

Unlike a simple HTTP middleware, jgit-proxy has three distinct places that open outbound connections, each using a different library. All three need proxy support:

  1. Store-and-forward upstream pushForwardingPostReceiveHook uses JGit's Transport.open(). JGit respects Java system properties (https.proxyHost, https.proxyPort, http.nonProxyHosts) but there's no way to set these from the YAML config today.

  2. Transparent proxy forwardingGitProxyServlet (Jetty's ProxyServlet) uses Jetty's internal HttpClient. Proxy support requires calling httpClient.getProxyConfiguration().addProxy(new HttpProxy(host, port)) at servlet setup time in GitProxyServletRegistrar.registerProxyServlet().

  3. Provider SCM API calls (identity resolution, etc.) — GitHubProvider, GitLabProvider, etc. use Apache HttpClient 5 via org.apache.hc.client5.http.fluent.Request. These need a RequestConfig or RoutePlanner configured with the proxy host/port.

The upstream Node.js implementation hooks proxy configuration into proxyReqOptDecorator in src/proxy/routes/index.ts (line 147, currently a no-op pass-through) — this only covers path 2. jgit-proxy needs all three covered.

Proposed configuration

New server.outboundProxy block alongside the existing timeout settings:

server:
  outboundProxy:
    host: proxy.corp.example.com
    port: 8080
    # Optional: skip proxy for these hosts (matches Java nonProxyHosts syntax)
    noProxy: "localhost|*.internal.example.com"

At startup:

  • Set https.proxyHost / https.proxyPort / http.nonProxyHosts as system properties (covers JGit Transport)
  • Pass proxy config into Jetty HttpClient in registerProxyServlet() (covers transparent proxy)
  • Build a shared Apache HC5 HttpClientBuilder with DefaultProxyRoutePlanner and inject it into all provider implementations (covers SCM API calls)

Documentation

The Node.js issue notes this is primarily a documentation gap for end users discovering the proxy in air-gapped environments. Alongside the config support, docs/CONFIGURATION.md should include a worked example for the corporate proxy case.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions