Skip to content

Support for x-forwarded-prefix #23263

@Tratcher

Description

@Tratcher

dotnet/yarp#13 (comment)

When requests traverse a reverse proxy it's common to change parts of the url like the scheme (TLS offloading). That information is sent to the app via additional x-forwarded-* headers. The Forwarded Headers middleware reads these headers and fixes up the request fields so that the application can still properly generate links.

One common manipulation that's not currently supported is to Trim the start of the request path and forward that missing information as part the x-forwarded-PathBase header.

Example:
Original url: https://external.com/pathbase/path?query
Transformed request:
http://internal/path?query
x-forwarded-proto: https
x-forwarded-host: external.com
x-forwarded-pathbase: /pathbase

x-forwarded-pathbase is now supported by YARP and enabled by default.
https://microsoft.github.io/reverse-proxy/articles/transforms.html

Metadata

Metadata

Assignees

No one assigned

    Labels

    affected-fewThis issue impacts only small number of customersapi-approvedAPI was approved in API review, it can be implementedarea-middlewareIncludes: URL rewrite, redirect, response cache/compression, session, and other general middlewaresenhancementThis issue represents an ask for new feature or an enhancement to an existing onehelp wantedUp for grabs. We would accept a PR to help resolve this issueseverity-minorThis label is used by an internal tool

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions