Skip to content

Conversation

@Symars
Copy link

@Symars Symars commented Oct 16, 2025

Summary

This PR adds an optional constructor to AppStoreServerAPIClient that allows users
to provide a custom java.net.Proxy for outbound HTTPS connections.

Motivation

Some developers need to route App Store Server API requests through corporate
proxies or debugging tools (e.g., Charles, Fiddler). This change preserves
backward compatibility while enabling flexible network configuration.

Changes

  • Added constructor accepting java.net.Proxy
  • Added corresponding convenience constructor for key-based initialization

@alexanderjordanbaker
Copy link
Collaborator

Is this not already handled here? #93

@Symars
Copy link
Author

Symars commented Oct 16, 2025

Is this not already handled here? #93

Thank you for the review!

Our production system integrates with multiple payment and service providers. Each provider has different network requirements and often needs to be routed through a dedicated proxy for security auditing, logging, or region-specific routing.

The current implementation of AppStoreServerAPIClient relies on global JVM proxy configuration (java.net.ProxySelector or system properties such as https.proxyHost).
This approach works for single-proxy environments but cannot support multiple concurrent proxies in one JVM process.

By adding an optional constructor that accepts a java.net.Proxy, this PR enables:

Per-client, per-channel proxy routing.

Independent network configurations for different service integrations.

Full backward compatibility — the existing constructors and behavior remain unchanged.

This change is minimal, safe, and improves flexibility for enterprise or multi-tenant payment systems that interact with the App Store Server API alongside other vendors.

* @param environment The environment to target
* @param proxy Optional HTTP proxy (can be null for direct connection)
*/
public AppStoreServerAPIClient(BearerTokenAuthenticatorInterface bearerTokenAuthenticator,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we have the existing constructor delegate to these new constructors with a null proxy please? That should reduce code duplication

* @param issuerId Your issuer ID from the Keys page in App Store Connect
* @param bundleId Your app’s bundle ID
* @param environment The environment to target
* @param proxy Optional HTTP proxy (can be null for direct connection)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we reword this slightly to HTTP Proxy, use null for direct connections

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants