Skip to content

Update ProxyResponse documentation to reference IForwarderErrorFeature #2854

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

Copilot
Copy link

@Copilot Copilot AI commented May 20, 2025

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 Copilot AI changed the title [WIP] ProxyResponse is null in AddResponseTransform Update ProxyResponse documentation to reference IForwarderErrorFeature May 20, 2025
@Copilot Copilot AI requested a review from MihaZupan May 20, 2025 15:05
@MihaZupan MihaZupan marked this pull request as ready for review May 20, 2025 16:26
@MihaZupan MihaZupan requested a review from benjaminpetit as a code owner May 20, 2025 16:26
@MihaZupan MihaZupan added the Type: Documentation Improvements or additions to documentation label May 20, 2025
@MihaZupan MihaZupan added this to the YARP 3.0 milestone May 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ProxyResponse is null in AddResponseTransform
2 participants