reverse-proxy icon indicating copy to clipboard operation
reverse-proxy copied to clipboard

Update ProxyResponse documentation to reference IForwarderErrorFeature

Open Copilot opened this issue 7 months ago • 0 comments

Issue Description

When users encounter a null ResponseTransformContext.ProxyResponse in a response transform, they currently don't have clear guidance on how to get more information about the error that occurred.

Changes

This PR adds documentation to the ResponseTransformContext.ProxyResponse property explaining how to access error details when the response is null:

  1. Added a using directive for Yarp.ReverseProxy.Forwarder namespace to properly reference IForwarderErrorFeature
  2. Enhanced the XML documentation to recommend checking HttpContext.Features.Get<IForwarderErrorFeature>() or using HttpContextFeaturesExtensions.GetForwarderErrorFeature(HttpContext) to get details about the error

Before Change:

/// <summary>
/// The proxy response. This can be null if the destination did not respond.
/// </summary>
public HttpResponseMessage? ProxyResponse { get; init; }

After Change:

/// <summary>
/// The proxy response. This can be null if the destination did not respond.
/// When null, check <see cref="HttpContext.Features.Get{IForwarderErrorFeature}()"/> 
/// or <see cref="HttpContextFeaturesExtensions.GetForwarderErrorFeature(HttpContext)"/>
/// for details about the error via the <see cref="IForwarderErrorFeature"/>.
/// </summary>
public HttpResponseMessage? ProxyResponse { get; init; }

This documentation improvement helps users discover how to access error information when handling null responses in response transforms.

Fixes #2562.

[!WARNING]

Firewall rules blocked me from connecting to one or more addresses

I tried to connect to the following addresses, but was blocked by firewall rules:

  • dc.services.visualstudio.com
    • Triggering command: /home/REDACTED/work/yarp/yarp/.dotnet/dotnet msbuild /m /nologo /clp:Summary /v:minimal /nr:true /warnaserror /p:TreatWarningsAsErrors=true /p:ContinuousIntegrationBuild=false /home/REDACTED/work/yarp/yarp/artifacts/toolset/restore.proj /t:__WriteToolsetLocation /clp:ErrorsOnly;NoSummary /p:__ToolsetLocationOutputFile=/home/REDACTED/work/yarp/yarp/artifacts/toolset/10.0.0-beta.25268.1.txt (dns block)
  • pkgs.dev.azure.com
    • Triggering command: /home/REDACTED/work/yarp/yarp/.dotnet/dotnet msbuild /m /nologo /clp:Summary /v:minimal /nr:true /warnaserror /p:TreatWarningsAsErrors=true /p:ContinuousIntegrationBuild=false /home/REDACTED/work/yarp/yarp/artifacts/toolset/restore.proj /t:__WriteToolsetLocation /clp:ErrorsOnly;NoSummary /p:__ToolsetLocationOutputFile=/home/REDACTED/work/yarp/yarp/artifacts/toolset/10.0.0-beta.25268.1.txt (dns block)

If you need me to access, download, or install something from one of these locations, you can either:


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot avatar May 20 '25 14:05 Copilot