Dela via


HttpTransformer Class

Definition

public class HttpTransformer
type HttpTransformer = class
Public Class HttpTransformer
Inheritance
HttpTransformer

Constructors

HttpTransformer()

Used to create derived instances.

Fields

Default

A default set of transforms that adds X-Forwarded-* headers, removes the original Host value and copies all other request and response fields and headers, except for some protocol specific values.

Empty

An empty transformer that copies all request and response fields and headers, except for some protocol specific values.

Methods

TransformRequestAsync(HttpContext, HttpRequestMessage, String, CancellationToken)

A callback that is invoked prior to sending the proxied request. All HttpRequestMessage fields are initialized except RequestUri, which will be initialized after the callback if no value is provided. See MakeDestinationAddress(String, PathString, QueryString) for constructing a custom request Uri. The string parameter represents the destination URI prefix that should be used when constructing the RequestUri. The headers are copied by the base implementation, excluding some protocol headers like HTTP/2 pseudo headers (":authority"). This method may be overridden to conditionally produce a response, such as for error conditions, and prevent the request from being proxied. This is indicated by setting the HttpResponse.StatusCode to a value other than 200, or calling HttpResponse.StartAsync(), or writing to the HttpResponse.Body or BodyWriter.

TransformRequestAsync(HttpContext, HttpRequestMessage, String)
Obsolete.

A callback that is invoked prior to sending the proxied request. All HttpRequestMessage fields are initialized except RequestUri, which will be initialized after the callback if no value is provided. See MakeDestinationAddress(String, PathString, QueryString) for constructing a custom request Uri. The string parameter represents the destination URI prefix that should be used when constructing the RequestUri. The headers are copied by the base implementation, excluding some protocol headers like HTTP/2 pseudo headers (":authority"). This method may be overridden to conditionally produce a response, such as for error conditions, and prevent the request from being proxied. This is indicated by setting the HttpResponse.StatusCode to a value other than 200, or calling HttpResponse.StartAsync(), or writing to the HttpResponse.Body or BodyWriter.

TransformResponseAsync(HttpContext, HttpResponseMessage, CancellationToken)

A callback that is invoked when the proxied response is received. The status code and reason phrase will be copied to the HttpContext.Response before the callback is invoked, but may still be modified there. The headers will be copied to HttpContext.Response.Headers by the base implementation, excludes certain protocol headers like Transfer-Encoding: chunked.

TransformResponseAsync(HttpContext, HttpResponseMessage)
Obsolete.

A callback that is invoked when the proxied response is received. The status code and reason phrase will be copied to the HttpContext.Response before the callback is invoked, but may still be modified there. The headers will be copied to HttpContext.Response.Headers by the base implementation, excludes certain protocol headers like Transfer-Encoding: chunked.

TransformResponseTrailersAsync(HttpContext, HttpResponseMessage, CancellationToken)

A callback that is invoked after the response body to modify trailers, if supported. The trailers will be copied to the HttpContext.Response by the base implementation.

TransformResponseTrailersAsync(HttpContext, HttpResponseMessage)
Obsolete.

A callback that is invoked after the response body to modify trailers, if supported. The trailers will be copied to the HttpContext.Response by the base implementation.

Applies to