Skip to content

Commit a183043

Browse files
auto-wireup & xforward docs
1 parent d881cb1 commit a183043

File tree

2 files changed

+30
-8
lines changed

2 files changed

+30
-8
lines changed

src/content/docs/bff/architecture/multi-frontend.md

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -67,19 +67,13 @@ If you don't want this automatic mapping of BFF middleware, you can turn it off
6767
```csharp
6868
var app = builder.Build();
6969

70-
app.UseBffFrontendSelection();
71-
app.UseBffPathMapping();
72-
app.UseBffOpenIdCallbacks();
70+
app.UseBffPreProcessing();
7371

7472
// TODO: your custom middleware goes here
7573
app.UseRouting();
7674
app.UseBff();
7775

78-
// NOTE: Only add this if you want to proxy remote APIs.
79-
app.UseBffRemoteRoutes();
80-
81-
app.MapBffManagementEndpoints();
82-
app.UseBffIndexPages();
76+
app.UseBffPostProcessing();
8377

8478
app.Run();
8579
```

src/content/docs/bff/fundamentals/options.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,3 +200,31 @@ The following options are available:
200200
BffClientAuthenticationStateProvider to the /bff/user endpoint. Defaults to 5000
201201
ms.
202202

203+
204+
# XForward header configuration
205+
206+
Added in V4
207+
208+
Should BFF run behind another proxy, then you'll want to use X-Forwarded headers.
209+
210+
BFF automatically registers the XForward header middleware in the pipeline. However,
211+
it doesn't do anything without configuration. Below is an example on how you can confiugre this.
212+
213+
```csharp
214+
builder.Services.Configure<ForwardedHeadersOptions>(options =>
215+
{
216+
// Consider configuring the 'KnownProxies' and the 'AllowedHosts' to prevent IP spoofing attacks
217+
options.ForwardedHeaders =
218+
ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto;
219+
});
220+
```
221+
222+
See [proxy-load-balancer](https://learn.microsoft.com/en-us/aspnet/core/host-and-deploy/proxy-load-balancer?view=aspnetcore-9.0) in the microsoft documentation
223+
for more information.
224+
225+
:::note
226+
Be careful with XForward headers from untrusted sources. This can leave you vulnerable to IP Spoofing attacks.
227+
See [Microsoft Security Advisory CVE-2018-0787](https://github.com/aspnet/Announcements/issues/295) for information
228+
on an elevation-of-privileges vulnerability that affects systems where the proxy doesn't validate or restrict Host headers to known good values.
229+
230+
:::

0 commit comments

Comments
 (0)