Add EnableRetryOnFailure to handle transient connection failures (57P01 terminating connection) #4

Merged
wjones merged 4 commits from development into main 2026-04-30 08:49:05 -04:00
Showing only changes of commit bad167656a - Show all commits
+16 -5
View File
@@ -83,11 +83,22 @@ public class ExceptionMiddleware
{
if (isAuthenticationError)
{
// Log authentication errors as warnings with user-friendly message
_logger.LogWarning(
"Access denied: Unable to process request. Authentication token missing or invalid. URL {Method} {Url}.",
context.Request.Method,
context.Request.Path);
// WebSocket authentication failures are expected when clients connect without tokens
// Log at Debug level to reduce noise, unless it's not a WebSocket endpoint
if (context.Request.Path.StartsWithSegments("/socket", StringComparison.OrdinalIgnoreCase))
{
_logger.LogDebug(
"WebSocket connection rejected: Authentication token missing or invalid. IP: {IP}",
context.Connection.RemoteIpAddress);
}
else
{
// Log authentication errors for non-WebSocket endpoints as warnings
_logger.LogWarning(
"Access denied: Unable to process request. Authentication token missing or invalid. URL {Method} {Url}.",
context.Request.Method,
context.Request.Path);
}
}
else
{