0

I'm using the library @azure/app-configuration in my Angular web site and it works great. I used it for feature flagging. I run into the issue, that when I change a feature flag state (enabled to disabled or vice versa), this is not reflected in the website.

When I check the Network tab, I can see a request, but its status is "from disk cache". request in network tab In the response headers, I don't see any cache control headers, but I do see a LastModified header. It seems that this may impact caching.

I can't find any option or setting in the AppConfigurationClient or the method getConfigurationSetting to disable caching or refresh. I tried the option "acceptDateTime" set to new Date() but that doesn't make any difference. Also been playing around with other options, no luck

Alternatively, would it be possible to clear the cache for this URL (https://{{name}}.azconfig.io)?

Boland
  • 1,531
  • 1
  • 14
  • 42
  • [Azure and Javascript application caching](https://stackoverflow.com/questions/48584752/azure-and-javascript-application-caching) and [Azure getConfigurationSetting to retrieve Azure feature flags - client side](https://github.com/Azure/azure-sdk-for-js/issues/22340) – Ecstasy Jul 15 '22 at 04:22
  • 1
    Thanks @DeepDave-MT Based on the second post, I've switched to a server side model. I.e. now my API connects to Azure App Configuration and I've implemented IMemoryCache. – Boland Jul 15 '22 at 05:18

2 Answers2

1

Based on the comment above, this issue describes that the library is not recommended for client side use. I agree, as I wasn't already very happy about exposing such a connection string in JS. So I've moved the logic to my API, implemented IMemoryCache, and now it works.

Boland
  • 1,531
  • 1
  • 14
  • 42
0

Just in case someone is still looking for a fix, adding cache-control header worked for me.

const setting = await client?.getConfigurationSetting(
   { key: 'keyname' },
   { requestOptions: { customHeaders: { 'cache-control': 'no-cache' } } }
);
Shantanu Paul
  • 706
  • 10
  • 26