diff --git a/aspnetcore/blazor/host-and-deploy/index.md b/aspnetcore/blazor/host-and-deploy/index.md
index 643304b84e26..a5bf4dcdc3fc 100644
--- a/aspnetcore/blazor/host-and-deploy/index.md
+++ b/aspnetcore/blazor/host-and-deploy/index.md
@@ -5,7 +5,7 @@ description: Discover how to host and deploy Blazor apps.
monikerRange: '>= aspnetcore-3.1'
ms.author: riande
ms.custom: mvc
-ms.date: 11/09/2021
+ms.date: 01/13/2022
no-loc: [Home, Privacy, Kestrel, appsettings.json, "ASP.NET Core Identity", cookie, Cookie, Blazor, "Blazor Server", "Blazor WebAssembly", "Identity", "Let's Encrypt", Razor, SignalR]
uid: blazor/host-and-deploy/index
---
@@ -73,58 +73,95 @@ Without specifying additional configuration for `CoolApp`, the sub-app in this s
To provide configuration for the Blazor app's base path of `https://www.contoso.com/CoolApp/`, set the relative root path.
-Blazor WebAssembly (`wwwroot/index.html`):
+By configuring the relative URL path for an app, a component that isn't in the root directory can construct URLs relative to the app's root path. Components at different levels of the directory structure can build links to other resources at locations throughout the app. The app base path is also used to intercept selected hyperlinks where the `href` target of the link is within the app base path URI space. The Blazor router handles the internal navigation.
-```html
-
-```
+In many hosting scenarios, the relative URL path to the app is the root of the app. In these default cases, the app's relative URL base path is the following:
+
+* Blazor WebAssembly: `/` configured as `` in `wwwroot/index.html`.
+* Blazor Server: `~/` configured as `` in `Pages/_Layout.cshtml`.
-**The trailing slash is required.**
+In other hosting scenarios, such as GitHub Pages and IIS sub-apps, the app base path must be set to the server's relative URL path of the app.
-In a Blazor Server app, use ***either*** of the following approaches:
+* Standalone Blazor WebAssembly:
-* Option 1: Use the `` tag in `Pages/_Layout.cshtml` to set the app's base path:
+ `wwwroot/index.html`:
```html
```
-
+
+ **The trailing slash is required.**
+
+* Hosted Blazor WebAssembly:
+
+ In the **`Client`** project, `wwwroot/index.html`:
+
+ ```html
+
+ ```
+
**The trailing slash is required.**
-* Option 2: Call in the app's request pipeline (`Program.cs`):
+ In the **`Server`** project, call in the app's request pipeline (`Program.cs`):
```csharp
app.UsePathBase("/CoolApp");
```
+
+* In a Blazor Server app, use ***either*** of the following approaches:
+
+ * Option 1: Use the `` tag in `Pages/_Layout.cshtml` to set the app's base path:
+
+ ```html
+
+ ```
+
+ **The trailing slash is required.**
+
+ * Option 2: Call in the app's request pipeline (`Program.cs`):
+
+ ```csharp
+ app.UsePathBase("/CoolApp");
+ ```
+
+ Calling is recommended when you also wish to run the Blazor Server app locally. For example, supply the launch URL in `Properties/launchSettings.json`:
- This approach (Option 2) is recommended when you also wish to run the Blazor Server app locally. For example, supply the launch URL in `Properties/launchSettings.json`:
-
- ```xml
- "launchUrl": "https://localhost:{PORT}/CoolApp",
- ```
-
- The `{PORT}` placeholder in the preceding example is the port that matches the secure port in the `applicationUrl` configuration path. The following example shows the full launch profile for an app at port 7279:
-
- ```xml
- "BlazorSample": {
- "commandName": "Project",
- "dotnetRunMessages": true,
- "launchBrowser": true,
- "applicationUrl": "https://localhost:7279;http://localhost:5279",
- "launchUrl": "https://localhost:7279/CoolApp",
- "environmentVariables": {
- "ASPNETCORE_ENVIRONMENT": "Development"
- }
- ```
+ ```xml
+ "launchUrl": "https://localhost:{PORT}/CoolApp",
+ ```
+
+ The `{PORT}` placeholder in the preceding example is the port that matches the secure port in the `applicationUrl` configuration path. The following example shows the full launch profile for an app at port 7279:
-> [!NOTE]
-> In typical configurations for Azure/IIS hosting, additional configuration usually isn't required. In some non-IIS hosting and reverse proxy hosting scenarios, additional Static File Middleware configuration might be required to serve static files correctly (for example, `app.UseStaticFiles("/CoolApp");`). The required configuration might require further configuration to serve the Blazor script (`_framework/blazor.server.js` or `_framework/blazor.webassembly.js`). For more information, see .
->
-> For third-party host support, check the host provider's documentation and interact with developers on public support forums to implement the correct configuration. Common general support forums include: [Stack Overflow (tag: `blazor`)](https://stackoverflow.com/questions/tagged/blazor), [ASP.NET Core Slack Team](http://tattoocoder.com/aspnet-slack-sign-up/), and [Blazor Gitter](https://gitter.im/aspnet/Blazor). *The preceding forums are not owned or controlled by Microsoft.*
+ ```xml
+ "BlazorSample": {
+ "commandName": "Project",
+ "dotnetRunMessages": true,
+ "launchBrowser": true,
+ "applicationUrl": "https://localhost:7279;http://localhost:5279",
+ "launchUrl": "https://localhost:7279/CoolApp",
+ "environmentVariables": {
+ "ASPNETCORE_ENVIRONMENT": "Development"
+ }
+ ```
+
+Do ***not*** prefix links throughout the app with a forward slash. Either avoid the use of a path segment separator or use dot-slash (`./`) relative path notation:
+
+* ❌ Incorrect: ``
+* ✔️ Correct: ``
+* ✔️ Correct: ``
+
+In [Blazor WebAssembly web API requests with the `HttpClient` service](xref:blazor/call-web-api?pivots=webassembly), confirm that JSON helpers () do ***not*** prefix URLs with a forward slash (`/`):
+
+* ❌ Incorrect: `var rsp = await client.GetFromJsonAsync("/api/Account");`
+* ✔️ Correct: `var rsp = await client.GetFromJsonAsync("api/Account");`
-By providing the relative URL path, a component that isn't in the root directory can construct URLs relative to the app's root path. Components at different levels of the directory structure can build links to other resources at locations throughout the app. The app base path is also used to intercept selected hyperlinks where the `href` target of the link is within the app base path URI space. The Blazor router handles the internal navigation.
+Do ***not*** prefix [Navigation Manager](xref:blazor/fundamentals/routing#uri-and-navigation-state-helpers) relative links with a forward slash. Either avoid the use of a path segment separator or use dot-slash (`./`) relative path notation:
-In many hosting scenarios, the relative URL path to the app is the root of the app. In these cases, the app's relative URL base path is a forward slash (`` for Blazor WebAssembly or `` for Blazor Server), which is the default configuration for a Blazor app. In other hosting scenarios, such as GitHub Pages and IIS sub-apps, the app base path must be set to the server's relative URL path of the app.
+* ❌ Incorrect: `NavigationManager.NavigateTo("/other");`
+* ✔️ Correct: `NavigationManager.NavigateTo("other");`
+* ✔️ Correct: `NavigationManager.NavigateTo("./other");`
+
+In typical configurations for Azure/IIS hosting, additional configuration usually isn't required. In some non-IIS hosting and reverse proxy hosting scenarios, additional Static File Middleware configuration might be required to serve static files correctly (for example, `app.UseStaticFiles("/CoolApp");`). The required configuration might require further configuration to serve the Blazor script (`_framework/blazor.server.js` or `_framework/blazor.webassembly.js`). For more information, see .
For a Blazor WebAssembly app with a non-root relative URL path (for example, ``), the app fails to find its resources *when run locally*. To overcome this problem during local development and testing, you can supply a *path base* argument that matches the `href` value of the `` tag at runtime. **Don't include a trailing slash.** To pass the path base argument when running the app locally, execute the `dotnet run` command from the app's directory with the `--pathbase` option:
@@ -140,17 +177,17 @@ dotnet run --pathbase=/CoolApp
The Blazor WebAssembly app responds locally at `http://localhost:port/CoolApp`.
-### Blazor Server `MapFallbackToPage` configuration
+## Blazor Server `MapFallbackToPage` configuration
In scenarios where an app requires a separate area with custom resources and Razor components:
-* Create a folder within the app's `Pages` folder to hold the resources. For example, an administator section of an app is created in a new folder named `Admin` (`Pages/Admin`).
+* Create a folder within the app's `Pages` folder to hold the resources. For example, an administrator section of an app is created in a new folder named `Admin` (`Pages/Admin`).
* Create a root page (`_Host.cshtml`) for the area. For example, create a `Pages/Admin/_Host.cshtml` file from the app's main root page (`Pages/_Host.cshtml`). Don't provide an `@page` directive in the Admin `_Host` page.
* Add a layout to the area's folder (for example, `Pages/Admin/_Layout.razor`). In the layout for the separate area, set the `` tag `href` to match the area's folder (for example, ``). For demonstration purposes, add `~/` to the static resources in the page. For example:
* `~/css/bootstrap/bootstrap.min.css`
* `~/css/site.css`
* `~/BlazorSample.styles.css` (the example app's namespace is `BlazorSample`)
- * `~/_framework/blazor.server.js` for the Blazor script
+ * `~/_framework/blazor.server.js` (Blazor script)
* If the area should have its own static asset folder, add the folder and specify its location to Static File Middleware in `Program.cs` (for example, `app.UseStaticFiles("/Admin/wwwroot")`).
* Razor components are added to the area's folder. At a minimum, add an `Index` component to the area folder with the correct `@page` directive for the area. For example, add a `Pages/Admin/Index.razor` file based on the app's default `Pages/Index.razor` file. Indicate the Admin area as the route template at the top of the file (`@page "/admin"`). Add additional components as needed. For example, `Pages/Admin/Component1.razor` with an `@page` directive and route template of `@page "/admin/component1`.
* In `Program.cs`, call for the area's request path immediately before the fallback root page path to the `_Host` page:
@@ -166,7 +203,7 @@ In scenarios where an app requires a separate area with custom resources and Raz
app.Run();
```
-### Host multiple Blazor WebAssembly apps
+## Host multiple Blazor WebAssembly apps
For more information on hosting multiple Blazor WebAssembly apps in a hosted Blazor solution, see .
@@ -238,38 +275,76 @@ Without specifying additional configuration for `CoolApp`, the sub-app in this s
To provide configuration for the Blazor app's base path of `https://www.contoso.com/CoolApp/`, set the relative root path.
-Blazor WebAssembly (`wwwroot/index.html`):
+By configuring the relative URL path for an app, a component that isn't in the root directory can construct URLs relative to the app's root path. Components at different levels of the directory structure can build links to other resources at locations throughout the app. The app base path is also used to intercept selected hyperlinks where the `href` target of the link is within the app base path URI space. The Blazor router handles the internal navigation.
-```html
-
-```
+In many hosting scenarios, the relative URL path to the app is the root of the app. In these default cases, the app's relative URL base path is the following:
+
+* Blazor WebAssembly: `/` configured as `` in `wwwroot/index.html`.
+* Blazor Server: `~/` configured as `` in `Pages/_Host.cshtml`.
-**The trailing slash is required.**
+In other hosting scenarios, such as GitHub Pages and IIS sub-apps, the app base path must be set to the server's relative URL path of the app.
-In a Blazor Server app, use ***either*** of the following approaches:
+* Standalone Blazor WebAssembly:
-* Option 1: Use the `` tag in `Pages/_Host.cshtml` to set the app's base path:
+ `wwwroot/index.html`:
```html
```
-
+
**The trailing slash is required.**
-* Option 2: Call in the app's request pipeline (`Program.cs`):
+* Hosted Blazor WebAssembly:
+
+ In the **`Client`** project, `wwwroot/index.html`:
+
+ ```html
+
+ ```
+
+ **The trailing slash is required.**
+
+ In the **`Server`** project, call in the app's request pipeline (`Startup.cs`):
```csharp
app.UsePathBase("/CoolApp");
```
-> [!NOTE]
-> In typical configurations for Azure/IIS hosting, additional configuration usually isn't required. In some non-IIS hosting and reverse proxy hosting scenarios, additional Static File Middleware configuration might be required to serve static files correctly (for example, `app.UseStaticFiles("/CoolApp");`). The required configuration might require further configuration to serve the Blazor script (`_framework/blazor.server.js` or `_framework/blazor.webassembly.js`). For more information, see .
->
-> For third-party host support, check the host provider's documentation and interact with developers on public support forums to implement the correct configuration. Common general support forums include: [Stack Overflow (tag: `blazor`)](https://stackoverflow.com/questions/tagged/blazor), [ASP.NET Core Slack Team](http://tattoocoder.com/aspnet-slack-sign-up/), and [Blazor Gitter](https://gitter.im/aspnet/Blazor). *The preceding forums are not owned or controlled by Microsoft.*
+* In a Blazor Server app, use ***either*** of the following approaches:
+
+ * Option 1: Use the `` tag in `Pages/_Host.cshtml` to set the app's base path:
+
+ ```html
+
+ ```
+
+ **The trailing slash is required.**
+
+ * Option 2: Call in the app's request pipeline (`Startup.cs`):
-By providing the relative URL path, a component that isn't in the root directory can construct URLs relative to the app's root path. Components at different levels of the directory structure can build links to other resources at locations throughout the app. The app base path is also used to intercept selected hyperlinks where the `href` target of the link is within the app base path URI space. The Blazor router handles the internal navigation.
+ ```csharp
+ app.UsePathBase("/CoolApp");
+ ```
-In many hosting scenarios, the relative URL path to the app is the root of the app. In these cases, the app's relative URL base path is a forward slash (`` for Blazor WebAssembly or `` for Blazor Server), which is the default configuration for a Blazor app. In other hosting scenarios, such as GitHub Pages and IIS sub-apps, the app base path must be set to the server's relative URL path of the app.
+ Calling is recommended when you also wish to run the Blazor Server app locally. For example, supply the launch URL in `Properties/launchSettings.json`:
+
+ ```xml
+ "launchUrl": "https://localhost:{PORT}/CoolApp",
+ ```
+
+ The `{PORT}` placeholder in the preceding example is the port that matches the secure port in the `applicationUrl` configuration path. The following example shows the full launch profile for an app at port 7279:
+
+ ```xml
+ "BlazorSample": {
+ "commandName": "Project",
+ "dotnetRunMessages": true,
+ "launchBrowser": true,
+ "applicationUrl": "https://localhost:7279;http://localhost:5279",
+ "launchUrl": "https://localhost:7279/CoolApp",
+ "environmentVariables": {
+ "ASPNETCORE_ENVIRONMENT": "Development"
+ }
+ ```
For a Blazor WebAssembly app with a non-root relative URL path (for example, ``), the app fails to find its resources *when run locally*. To overcome this problem during local development and testing, you can supply a *path base* argument that matches the `href` value of the `` tag at runtime. **Don't include a trailing slash.** To pass the path base argument when running the app locally, execute the `dotnet run` command from the app's directory with the `--pathbase` option:
@@ -285,17 +360,27 @@ dotnet run --pathbase=/CoolApp
The Blazor WebAssembly app responds locally at `http://localhost:port/CoolApp`.
+For additional third-party host support:
+
+* and
+*
+* Consult the host provider's documentation.
+* Consult developers on non-Microsoft support forums:
+ * [Stack Overflow (tag: `blazor`)](https://stackoverflow.com/questions/tagged/blazor)
+ * [ASP.NET Core Slack Team](http://tattoocoder.com/aspnet-slack-sign-up/)
+ * [Blazor Gitter](https://gitter.im/aspnet/Blazor)
+
### Blazor Server `MapFallbackToPage` configuration
In scenarios where an app requires a separate area with custom resources and Razor components:
-* Create a folder within the app's `Pages` folder to hold the resources. For example, an administator section of an app is created in a new folder named `Admin` (`Pages/Admin`).
+* Create a folder within the app's `Pages` folder to hold the resources. For example, an administrator section of an app is created in a new folder named `Admin` (`Pages/Admin`).
* Create a root page (`_Host.cshtml`) for the area. For example, create a `Pages/Admin/_Host.cshtml` file from the app's main root page (`Pages/_Host.cshtml`). Don't provide an `@page` directive in the Admin `_Host` page.
* Add a layout to the area's folder (for example, `Pages/Admin/_Layout.razor`). In the layout for the separate area, set the `` tag `href` to match the area's folder (for example, ``). For demonstration purposes, add `~/` to the static resources in the page. For example:
* `~/css/bootstrap/bootstrap.min.css`
* `~/css/site.css`
* `~/BlazorSample.styles.css` (the example app's namespace is `BlazorSample`)
- * `~/_framework/blazor.server.js` for the Blazor script
+ * `~/_framework/blazor.server.js` (Blazor script)
* If the area should have its own static asset folder, add the folder and specify its location to Static File Middleware in `Program.cs` (for example, `app.UseStaticFiles("/Admin/wwwroot")`).
* Razor components are added to the area's folder. At a minimum, add an `Index` component to the area folder with the correct `@page` directive for the area. For example, add a `Pages/Admin/Index.razor` file based on the app's default `Pages/Index.razor` file. Indicate the Admin area as the route template at the top of the file (`@page "/admin"`). Add additional components as needed. For example, `Pages/Admin/Component1.razor` with an `@page` directive and route template of `@page "/admin/component1`.
* In `Startup.Configure`, call for the area's request path immediately before the fallback root page path to the `_Host` page:
@@ -383,38 +468,76 @@ Without specifying additional configuration for `CoolApp`, the sub-app in this s
To provide configuration for the Blazor app's base path of `https://www.contoso.com/CoolApp/`, set the relative root path.
-Blazor WebAssembly (`wwwroot/index.html`):
+By configuring the relative URL path for an app, a component that isn't in the root directory can construct URLs relative to the app's root path. Components at different levels of the directory structure can build links to other resources at locations throughout the app. The app base path is also used to intercept selected hyperlinks where the `href` target of the link is within the app base path URI space. The Blazor router handles the internal navigation.
-```html
-
-```
+In many hosting scenarios, the relative URL path to the app is the root of the app. In these default cases, the app's relative URL base path is the following:
+
+* Blazor WebAssembly: `/` configured as `` in `wwwroot/index.html`.
+* Blazor Server: `~/` configured as `` in `Pages/_Host.cshtml`.
-**The trailing slash is required.**
+In other hosting scenarios, such as GitHub Pages and IIS sub-apps, the app base path must be set to the server's relative URL path of the app.
-In a Blazor Server app, use ***either*** of the following approaches:
+* Standalone Blazor WebAssembly:
-* Option 1: Use the `` tag in `Pages/_Host.cshtml` to set the app's base path:
+ `wwwroot/index.html`:
```html
```
-
+
**The trailing slash is required.**
-* Option 2: Call in the app's request pipeline (`Program.cs`):
+* Hosted Blazor WebAssembly:
+
+ In the **`Client`** project, `wwwroot/index.html`:
+
+ ```html
+
+ ```
+
+ **The trailing slash is required.**
+
+ In the **`Server`** project, call in the app's request pipeline (`Startup.cs`):
```csharp
app.UsePathBase("/CoolApp");
```
-> [!NOTE]
-> In typical configurations for Azure/IIS hosting, additional configuration usually isn't required. In some non-IIS hosting and reverse proxy hosting scenarios, additional Static File Middleware configuration might be required to serve static files correctly (for example, `app.UseStaticFiles("/CoolApp");`). The required configuration might require further configuration to serve the Blazor script (`_framework/blazor.server.js` or `_framework/blazor.webassembly.js`). For more information, see .
->
-> For third-party host support, check the host provider's documentation and interact with developers on public support forums to implement the correct configuration. Common general support forums include: [Stack Overflow (tag: `blazor`)](https://stackoverflow.com/questions/tagged/blazor), [ASP.NET Core Slack Team](http://tattoocoder.com/aspnet-slack-sign-up/), and [Blazor Gitter](https://gitter.im/aspnet/Blazor). *The preceding forums are not owned or controlled by Microsoft.*
+* In a Blazor Server app, use ***either*** of the following approaches:
+
+ * Option 1: Use the `` tag in `Pages/_Host.cshtml` to set the app's base path:
-By providing the relative URL path, a component that isn't in the root directory can construct URLs relative to the app's root path. Components at different levels of the directory structure can build links to other resources at locations throughout the app. The app base path is also used to intercept selected hyperlinks where the `href` target of the link is within the app base path URI space. The Blazor router handles the internal navigation.
+ ```html
+
+ ```
-In many hosting scenarios, the relative URL path to the app is the root of the app. In these cases, the app's relative URL base path is a forward slash (`` for Blazor WebAssembly or `` for Blazor Server), which is the default configuration for a Blazor app. In other hosting scenarios, such as GitHub Pages and IIS sub-apps, the app base path must be set to the server's relative URL path of the app.
+ **The trailing slash is required.**
+
+ * Option 2: Call in the app's request pipeline (`Startup.cs`):
+
+ ```csharp
+ app.UsePathBase("/CoolApp");
+ ```
+
+ Calling is recommended when you also wish to run the Blazor Server app locally. For example, supply the launch URL in `Properties/launchSettings.json`:
+
+ ```xml
+ "launchUrl": "https://localhost:{PORT}/CoolApp",
+ ```
+
+ The `{PORT}` placeholder in the preceding example is the port that matches the secure port in the `applicationUrl` configuration path. The following example shows the full launch profile for an app at port 7279:
+
+ ```xml
+ "BlazorSample": {
+ "commandName": "Project",
+ "dotnetRunMessages": true,
+ "launchBrowser": true,
+ "applicationUrl": "https://localhost:7279;http://localhost:5279",
+ "launchUrl": "https://localhost:7279/CoolApp",
+ "environmentVariables": {
+ "ASPNETCORE_ENVIRONMENT": "Development"
+ }
+ ```
For a Blazor WebAssembly app with a non-root relative URL path (for example, ``), the app fails to find its resources *when run locally*. To overcome this problem during local development and testing, you can supply a *path base* argument that matches the `href` value of the `` tag at runtime. **Don't include a trailing slash.** To pass the path base argument when running the app locally, execute the `dotnet run` command from the app's directory with the `--pathbase` option:
@@ -430,17 +553,27 @@ dotnet run --pathbase=/CoolApp
The Blazor WebAssembly app responds locally at `http://localhost:port/CoolApp`.
+For additional third-party host support:
+
+* and
+*
+* Consult the host provider's documentation.
+* Consult developers on non-Microsoft support forums:
+ * [Stack Overflow (tag: `blazor`)](https://stackoverflow.com/questions/tagged/blazor)
+ * [ASP.NET Core Slack Team](http://tattoocoder.com/aspnet-slack-sign-up/)
+ * [Blazor Gitter](https://gitter.im/aspnet/Blazor)
+
### Blazor Server `MapFallbackToPage` configuration
In scenarios where an app requires a separate area with custom resources and Razor components:
-* Create a folder within the app's `Pages` folder to hold the resources. For example, an administator section of an app is created in a new folder named `Admin` (`Pages/Admin`).
+* Create a folder within the app's `Pages` folder to hold the resources. For example, an administrator section of an app is created in a new folder named `Admin` (`Pages/Admin`).
* Create a root page (`_Host.cshtml`) for the area. For example, create a `Pages/Admin/_Host.cshtml` file from the app's main root page (`Pages/_Host.cshtml`). Don't provide an `@page` directive in the Admin `_Host` page.
* Add a layout to the area's folder (for example, `Pages/Admin/_Layout.razor`). In the layout for the separate area, set the `` tag `href` to match the area's folder (for example, ``). For demonstration purposes, add `~/` to the static resources in the page. For example:
* `~/css/bootstrap/bootstrap.min.css`
* `~/css/site.css`
* `~/BlazorSample.styles.css` (the example app's namespace is `BlazorSample`)
- * `~/_framework/blazor.server.js` for the Blazor script
+ * `~/_framework/blazor.server.js` (Blazor script)
* If the area should have its own static asset folder, add the folder and specify its location to Static File Middleware in `Program.cs` (for example, `app.UseStaticFiles("/Admin/wwwroot")`).
* Razor components are added to the area's folder. At a minimum, add an `Index` component to the area folder with the correct `@page` directive for the area. For example, add a `Pages/Admin/Index.razor` file based on the app's default `Pages/Index.razor` file. Indicate the Admin area as the route template at the top of the file (`@page "/admin"`). Add additional components as needed. For example, `Pages/Admin/Component1.razor` with an `@page` directive and route template of `@page "/admin/component1`.
* In `Startup.Configure.cs`, call for the area's request path immediately before the fallback root page path to the `_Host` page:
diff --git a/aspnetcore/blazor/host-and-deploy/server.md b/aspnetcore/blazor/host-and-deploy/server.md
index f52b307d3ba9..96fb34c589fc 100644
--- a/aspnetcore/blazor/host-and-deploy/server.md
+++ b/aspnetcore/blazor/host-and-deploy/server.md
@@ -5,7 +5,7 @@ description: Learn how to host and deploy a Blazor Server app using ASP.NET Core
monikerRange: '>= aspnetcore-3.1'
ms.author: riande
ms.custom: mvc
-ms.date: 11/09/2021
+ms.date: 01/13/2022
no-loc: [Home, Privacy, Kestrel, appsettings.json, "ASP.NET Core Identity", cookie, Cookie, Blazor, "Blazor Server", "Blazor WebAssembly", "Identity", "Let's Encrypt", Razor, SignalR]
uid: blazor/host-and-deploy/server
---
@@ -42,7 +42,7 @@ Blazor works best when using [WebSockets](xref:fundamentals/websockets) as the S
Blazor Server emits a console warning if it detects Long Polling is utilized:
-> Failed to connect via WebSockets, using the Long Polling fallback transport. This may be due to a VPN or proxy blocking the connection. To troubleshoot this, visit https://aka.ms/blazor-server-using-fallback-long-polling.
+> Failed to connect via WebSockets, using the Long Polling fallback transport. This may be due to a VPN or proxy blocking the connection.
## Azure SignalR Service
@@ -134,40 +134,22 @@ metadata:
## Linux with Nginx
-For SignalR WebSockets to function properly, confirm that the proxy's `Upgrade` and `Connection` headers are set to the following values and that `$connection_upgrade` is mapped to either:
-
-* The Upgrade header value by default.
-* `close` when the Upgrade header is missing or empty.
-
-```
-http {
- map $http_upgrade $connection_upgrade {
- default Upgrade;
- '' close;
- }
+Follow the guidance for an [ASP.NET Core SignalR app](xref:signalr/scale#linux-with-nginx) with the following changes:
- server {
- listen 80;
- server_name example.com *.example.com
- location / {
- proxy_pass http://localhost:5000;
- proxy_http_version 1.1;
- proxy_set_header Upgrade $http_upgrade;
- proxy_set_header Connection $connection_upgrade;
- proxy_set_header Host $host;
- proxy_cache_bypass $http_upgrade;
- proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
- proxy_set_header X-Forwarded-Proto $scheme;
- }
- }
-}
-```
+* Change the `location` path from `/hubroute` (`location /hubroute { ... }`) to the root path `/` (`location / { ... }`).
+* Remove the configuration for proxy buffering (`proxy_buffering off;`) because the setting only applies to [Server-Sent Events (SSE)](https://developer.mozilla.org/docs/Web/API/Server-sent_events), which aren't relevant to Blazor app client-server interactions.
-For more information, see the following articles:
+For more information and configuration guidance, consult the following resources:
+*
+*
+*
* [NGINX as a WebSocket Proxy](https://www.nginx.com/blog/websocket-nginx/)
* [WebSocket proxying](http://nginx.org/docs/http/websocket.html)
-*
+* Consult developers on non-Microsoft support forums:
+ * [Stack Overflow (tag: `blazor`)](https://stackoverflow.com/questions/tagged/blazor)
+ * [ASP.NET Core Slack Team](http://tattoocoder.com/aspnet-slack-sign-up/)
+ * [Blazor Gitter](https://gitter.im/aspnet/Blazor)
## Linux with Apache
@@ -196,13 +178,21 @@ a2enmod proxy_wstunnel
Check the browser console for WebSockets errors. Example errors:
-* Firefox can't establish a connection to the server at ws://the-domain-name.tld/_blazor?id=XXX.
+* Firefox can't establish a connection to the server at :::no-loc text="ws://the-domain-name.tld/_blazor?id=XXX":::
* Error: Failed to start the transport 'WebSockets': Error: There was an error with the transport.
* Error: Failed to start the transport 'LongPolling': TypeError: this.transport is undefined
* Error: Unable to connect to the server with any of the available transports. WebSockets failed
* Error: Cannot send data if the connection is not in the 'Connected' State.
-For more information, see the [Apache documentation](https://httpd.apache.org/docs/current/mod/mod_proxy.html).
+For more information and configuration guidance, consult the following resources:
+
+*
+*
+* [Apache documentation](https://httpd.apache.org/docs/current/mod/mod_proxy.html)
+* Consult developers on non-Microsoft support forums:
+ * [Stack Overflow (tag: `blazor`)](https://stackoverflow.com/questions/tagged/blazor)
+ * [ASP.NET Core Slack Team](http://tattoocoder.com/aspnet-slack-sign-up/)
+ * [Blazor Gitter](https://gitter.im/aspnet/Blazor)
## Measure network latency
@@ -333,12 +323,20 @@ metadata:
nginx.ingress.kubernetes.io/session-cookie-max-age: "14400"
```
+For additional Kubernetes host support, consult the following resources:
+
+* [Kubernetes documentation](https://kubernetes.io/docs/home/)
+* Developers on non-Microsoft support forums:
+ * [Stack Overflow (tag: `blazor`)](https://stackoverflow.com/questions/tagged/blazor)
+ * [ASP.NET Core Slack Team](http://tattoocoder.com/aspnet-slack-sign-up/)
+ * [Blazor Gitter](https://gitter.im/aspnet/Blazor)
+
## Linux with Nginx
For SignalR WebSockets to function properly, confirm that the proxy's `Upgrade` and `Connection` headers are set to the following values and that `$connection_upgrade` is mapped to either:
-* The Upgrade header value by default.
-* `close` when the Upgrade header is missing or empty.
+* The `Upgrade` header value by default.
+* `close` when the `Upgrade` header is missing or empty.
```
http {
@@ -364,11 +362,16 @@ http {
}
```
-For more information, see the following articles:
+For additional Nginx host support, consult the following resources:
-* [NGINX as a WebSocket Proxy](https://www.nginx.com/blog/websocket-nginx/)
-* [WebSocket proxying](http://nginx.org/docs/http/websocket.html)
*
+* Nginx documentation:
+ * [NGINX as a WebSocket Proxy](https://www.nginx.com/blog/websocket-nginx/)
+ * [WebSocket proxying](http://nginx.org/docs/http/websocket.html)
+* Developers on non-Microsoft support forums:
+ * [Stack Overflow (tag: `blazor`)](https://stackoverflow.com/questions/tagged/blazor)
+ * [ASP.NET Core Slack Team](http://tattoocoder.com/aspnet-slack-sign-up/)
+ * [Blazor Gitter](https://gitter.im/aspnet/Blazor)
## Linux with Apache
@@ -403,7 +406,14 @@ Check the browser console for WebSockets errors. Example errors:
* Error: Unable to connect to the server with any of the available transports. WebSockets failed
* Error: Cannot send data if the connection is not in the 'Connected' State.
-For more information, see the [Apache documentation](https://httpd.apache.org/docs/current/mod/mod_proxy.html).
+For additional Apache host support, consult the following resources:
+
+*
+* [Apache documentation](https://httpd.apache.org/docs/current/mod/mod_proxy.html)
+* Developers on non-Microsoft support forums:
+ * [Stack Overflow (tag: `blazor`)](https://stackoverflow.com/questions/tagged/blazor)
+ * [ASP.NET Core Slack Team](http://tattoocoder.com/aspnet-slack-sign-up/)
+ * [Blazor Gitter](https://gitter.im/aspnet/Blazor)
## Measure network latency
@@ -563,8 +573,8 @@ metadata:
For SignalR WebSockets to function properly, confirm that the proxy's `Upgrade` and `Connection` headers are set to the following values and that `$connection_upgrade` is mapped to either:
-* The Upgrade header value by default.
-* `close` when the Upgrade header is missing or empty.
+* The `Upgrade` header value by default.
+* `close` when the `Upgrade` header is missing or empty.
```
http {
diff --git a/aspnetcore/blazor/host-and-deploy/webassembly.md b/aspnetcore/blazor/host-and-deploy/webassembly.md
index 8a14378bd6cc..ebdf9c68258e 100644
--- a/aspnetcore/blazor/host-and-deploy/webassembly.md
+++ b/aspnetcore/blazor/host-and-deploy/webassembly.md
@@ -5,7 +5,7 @@ description: Learn how to host and deploy a Blazor app using ASP.NET Core, Conte
monikerRange: '>= aspnetcore-3.1'
ms.author: riande
ms.custom: mvc
-ms.date: 11/09/2021
+ms.date: 01/13/2022
no-loc: [Home, Privacy, Kestrel, appsettings.json, "ASP.NET Core Identity", cookie, Cookie, Blazor, "Blazor Server", "Blazor WebAssembly", "Identity", "Let's Encrypt", Razor, SignalR]
uid: blazor/host-and-deploy/webassembly
---
@@ -662,6 +662,136 @@ The `--urls` argument sets the IP addresses or host addresses with ports and pro
--urls=http://127.0.0.1:0
```
+## Hosted deployment on Linux (Nginx)
+
+Configure the app with to forward the `X-Forwarded-For` and `X-Forwarded-Proto` headers by following the guidance in .
+
+For more information on setting the app's base path, including sub-app path configuration, see .
+
+Follow the guidance for an [ASP.NET Core SignalR app](xref:signalr/scale#linux-with-nginx) with the following changes:
+
+* Remove the configuration for proxy buffering (`proxy_buffering off;`) because the setting only applies to [Server-Sent Events (SSE)](https://developer.mozilla.org/docs/Web/API/Server-sent_events), which aren't relevant to Blazor app client-server interactions.
+* Change the `location` path from `/hubroute` (`location /hubroute { ... }`) to the sub-app path `/{PATH}` (`location /{PATH} { ... }`), where the `{PATH}` placeholder is the sub-app path.
+
+ The following example configures the server for an app that responds to requests at the root path `/`:
+
+ ```
+ http {
+ server {
+ ...
+ location / {
+ ...
+ }
+ }
+ }
+ ```
+
+ The following example configures the sub-app path of `/blazor`:
+
+ ```
+ http {
+ server {
+ ...
+ location /blazor {
+ ...
+ }
+ }
+ }
+ ```
+
+For more information and configuration guidance, consult the following resources:
+
+*
+* Nginx documentation:
+ * [NGINX as a WebSocket Proxy](https://www.nginx.com/blog/websocket-nginx/)
+ * [WebSocket proxying](http://nginx.org/docs/http/websocket.html)
+* Developers on non-Microsoft support forums:
+ * [Stack Overflow (tag: `blazor`)](https://stackoverflow.com/questions/tagged/blazor)
+ * [ASP.NET Core Slack Team](http://tattoocoder.com/aspnet-slack-sign-up/)
+ * [Blazor Gitter](https://gitter.im/aspnet/Blazor)
+
+
+
## Configure the Trimmer
Blazor performs Intermediate Language (IL) trimming on each Release build to remove unnecessary IL from the output assemblies. For more information, see .
diff --git a/aspnetcore/host-and-deploy/linux-nginx.md b/aspnetcore/host-and-deploy/linux-nginx.md
index 8a12fb103eb2..62b209844861 100644
--- a/aspnetcore/host-and-deploy/linux-nginx.md
+++ b/aspnetcore/host-and-deploy/linux-nginx.md
@@ -128,7 +128,7 @@ Verify a browser displays the default landing page for Nginx. The landing page i
To configure Nginx as a reverse proxy to forward HTTP requests to your ASP.NET Core app, modify `/etc/nginx/sites-available/default`. Open it in a text editor, and replace the contents with the following snippet:
-```nginx
+```
server {
listen 80;
server_name example.com *.example.com;
@@ -149,7 +149,7 @@ If the app is a SignalR or Blazor Server app, see