Make SessionProtocolNegotiationCache behavior configurable
We're encountering an issue where SessionProtocolNegotiationCache causes clients to persistently downgrade to HTTP/1.1 after a transient failure, even after the server becomes ready to support HTTP/2. This is particularly problematic when using tools like ngrok, which may initially respond with HTTP/1.1 while a tunnel is still initializing. Once the Armeria client receives this response, it caches the result and never retries with HTTP/2.
Proposed Improvements:
We would like to discuss possible enhancements to make the cache behavior more flexible. Some options are:
-
Time-based expiration: Allow cached entries to expire after a configurable duration.
-
Address-level opt-out: Provide a configuration mechanism to skip caching for a specific list of socket addresses.
-
Global opt-out: Add a configuration toggle to disable SessionProtocolNegotiationCache entirely.
IMO, 1 and 3 can be implemented via an SPI-based cache configuration.
Let me know wdyt thanks!
https://discord.com/channels/1087271586832318494/1087272728177942629/1359366099145199798