Skip to content

Commit

Permalink
Document reverse proxy adjustments
Browse files Browse the repository at this point in the history
  • Loading branch information
Kaliumhexacyanoferrat committed Jan 21, 2025
1 parent 3929080 commit f1fbe5c
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions content/documentation/content/handlers/reverse-proxy.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,14 @@ cascade:
{{< /cards >}}

The reverse proxy content provider allows to embed content from another
web server into your application. Content returned by the upstream
server will not be embedded into a templated page.
web server into your application.

```csharp
var proxy = ReverseProxy.Create()
.Upstream("http://my-cdn:8080/");

await Host.Create()
.Handler(ReverseProxy.Create().Upstream("http://my-cdn:8080/"))
.Handler(proxy)
.RunAsync();
```

Expand All @@ -24,3 +26,15 @@ proxied to http://my-cdn:8080/.

If the upstream server is either not available or does not respond in time,
the provider will return a HTTP 502/504 error page instead.

## Adjustments

The module internally uses the `HttpClient` to perform HTTP requests. If needed,
you can pass actions to adjust the client as required.

```csharp
var proxy = ReverseProxy.Create()
.Upstream("http://my-cdn:8080/")
.AdjustHandler(h => h.Proxy = null)
.AdjustClient(c => c.MaxResponseContentBufferSize = 10000);
```

0 comments on commit f1fbe5c

Please sign in to comment.