Feature Flags behind a Proxy

Feature flag services are getting popular, but...

As feature flags are getting popular, an ever-growing number of developers are facing the challenges associated with them.

No matter if you implement your own feature flag library, or choose a hosted feature flag service like ConfigCat, chances are high you want to use your feature flags in your frontend and in your backend services as well.

If your feature flags can be toggled on a central feature flag dashboard, such as ConfigCat's Dashboard (and they really should be) then your backend code should have an active internet connection to that central feature flag dashboard, so new feature flag values can be populated to your application's backend.

(407) Proxy Authentication Required

Things are getting hard if your backend code can access the internet through a proxy only. You know what I'm talking about if you have ever received

The remote server returned an error: (407) Proxy Authentication Required

You can solve the situation by properly configuring the proxy settings in the feature flag library that your backend is using. This means you should be able to pass the proxy server, proxy port, proxy username, and proxy password parameters into the feature flag lib.

Proxy support built into the feature flag service

ConfigCat has a built-in solution for configuring proxy server, proxy port, proxy username, and proxy password. Just wrap these parameters into .NET's built-in HttpClientHandler and pass it into the ConfigCatClient through the client's configuration. A .NET/C# code example is:

var myProxySettings = new WebProxy(proxyHost, proxyPort)
{
UseDefaultCredentials = false,
Credentials = new NetworkCredential(proxyUserName, proxyPassword)
};
var myHttpClientHandler = new HttpClientHandler { Proxy = myProxySettings };
var client = new ConfigCatClient(new AutoPollConfiguration
{
HttpClientHandler = myHttpClientHandler,
SdkKey = "#YOUR-SDK-KEY#",
});

ConfigCat is a hosted cross-platform feature flag service

See more feature flag example codes by checking ConfigCat docs at https://configcat.com/docs.