Skip to content

Adding router proxy support #747

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

cx-serhii-stanislavskyi

Add Router Proxy Configuration from Environment Variables

This PR adds two new functions to improve router connectivity options:

Changes

  1. Added routerProxyFromEnvironment function

    • Enables automatic proxy configuration for router connections based on environment variables
    • Uses HTTPS_PROXY or HTTP_PROXY environment variables to determine proxy settings
    • Automatically applied when loading configuration from file via NewConfigFromFile()
  2. Added parseTLS(raw string) helper function

    • Supports router URLs with the format tls:router.example.com:443
    • Converts tls: scheme URLs to proper HTTPS URLs for processing
    • Enables more flexible router addressing options

Use Cases

  • Simplifies deployment in environments where direct connections are restricted and proxies are required
  • Allows for consistent proxy configuration across applications using environment variables
  • Supports more intuitive TLS connection specification with the tls: URL format

These changes maintain backward compatibility while adding flexibility for different network configurations.

@cx-serhii-stanislavskyi cx-serhii-stanislavskyi requested a review from a team as a code owner June 18, 2025 13:38
@@ -127,3 +130,44 @@ func NewConfigFromFile(confFile string) (*Config, error) {
func GetControllerWellKnownCaPool(controllerAddr string) (*x509.CertPool, error) {
return rest_util.GetControllerWellKnownCaPool(controllerAddr)
}
Copy link
Member

Choose a reason for hiding this comment

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

Apologies for the late review.

First, if you haven't yet, please take a look at https://github.com/openziti/sdk-golang/blob/main/CONTRIBUTING.md as a CLA is required for contributors.

Second, overall looks good. I'd like this function to be available to SDK users, but not have it set on RouterProxy by default. To that end, could you remove the set and make the method public?

Copy link
Member

@plorenz plorenz left a comment

Choose a reason for hiding this comment

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

See comment

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.

None yet

2 participants