> ## Documentation Index
> Fetch the complete documentation index at: https://easyaf.nimbleapps.cloud/llms.txt
> Use this file to discover all available pages before exploring further.

# CrossOriginIsolationMiddleware

> Middleware that adds Cross-Origin Isolation headers (COOP and COEP) to responses.              These headers are required for features like SharedArrayBuffer...

## Definition

**Assembly:** CloudNimble.BlazorEssentials.Server.dll

**Namespace:** CloudNimble.BlazorEssentials.Server.Middleware

**Inheritance:** System.Object

## Syntax

```csharp theme={"dark"}
CloudNimble.BlazorEssentials.Server.Middleware.CrossOriginIsolationMiddleware
```

## Summary

Middleware that adds Cross-Origin Isolation headers (COOP and COEP) to responses.
These headers are required for features like SharedArrayBuffer and high-resolution timers,
which are needed by WASM libraries like TursoDb that use OPFS (Origin Private File System).

## Remarks

\<strong>Warning:\</strong> Enabling cross-origin isolation may break third-party scripts,
iframes, and CDN resources that are not configured to work in an isolated context.
Test thoroughly before enabling in production.

Headers added:

* `Cross-Origin-Opener-Policy: same-origin` - Isolates the browsing context
* `Cross-Origin-Embedder-Policy: require-corp` - Requires all resources to explicitly grant permission

## Examples

```csharp theme={"dark"}
// In Program.cs
app.UseCrossOriginIsolation();

// Or with options
app.UseCrossOriginIsolation(options =&gt;
{
    options.CoopPolicy = "same-origin";
    options.CoepPolicy = "require-corp";
    options.ExcludePaths.Add("/api/");
});
```

## Constructors

### &#x20;.ctor

Initializes a new instance of the [CrossOriginIsolationMiddleware](https://easyaf.nimbleapps.cloud/blazoressentials/api-reference/CloudNimble/BlazorEssentials/Server/Middleware/CrossOriginIsolationMiddleware.md) class.

#### Syntax

```csharp theme={"dark"}
public CrossOriginIsolationMiddleware(Microsoft.AspNetCore.Http.RequestDelegate next, CloudNimble.BlazorEssentials.Server.Middleware.CrossOriginIsolationOptions options = null)
```

#### Parameters

| Name | Type | Description |
| - | - | - |
| `next` | `Microsoft.AspNetCore.Http.RequestDelegate` | The next middleware in the pipeline. |
| `options` | `CloudNimble.BlazorEssentials.Server.Middleware.CrossOriginIsolationOptions?` | Configuration options for cross-origin isolation. |

### &#x20;.ctor Inherited

> [!NOTE]
>
> Inherited from `object`

#### Syntax

```csharp theme={"dark"}
public Object()
```

## Methods

### &#x20;Equals Inherited Virtual

> [!NOTE]
>
> Inherited from `object`

#### Syntax

```csharp theme={"dark"}
public virtual bool Equals(object obj)
```

#### Parameters

| Name | Type | Description |
| - | - | - |
| `obj` | `object?` | - |

#### Returns

Type: `bool`

### &#x20;Equals Inherited

> [!NOTE]
>
> Inherited from `object`

#### Syntax

```csharp theme={"dark"}
public static bool Equals(object objA, object objB)
```

#### Parameters

| Name | Type | Description |
| - | - | - |
| `objA` | `object?` | - |
| `objB` | `object?` | - |

#### Returns

Type: `bool`

### &#x20;GetHashCode Inherited Virtual

> [!NOTE]
>
> Inherited from `object`

#### Syntax

```csharp theme={"dark"}
public virtual int GetHashCode()
```

#### Returns

Type: `int`

### &#x20;GetType Inherited

> [!NOTE]
>
> Inherited from `object`

#### Syntax

```csharp theme={"dark"}
public System.Type GetType()
```

#### Returns

Type: `System.Type`

### &#x20;InvokeAsync

Invokes the middleware to add cross-origin isolation headers.

#### Syntax

```csharp theme={"dark"}
public System.Threading.Tasks.Task InvokeAsync(Microsoft.AspNetCore.Http.HttpContext context)
```

#### Parameters

| Name | Type | Description |
| - | - | - |
| `context` | `Microsoft.AspNetCore.Http.HttpContext` | The HTTP context. |

#### Returns

Type: `System.Threading.Tasks.Task`
A task representing the asynchronous operation.

### &#x20;MemberwiseClone Inherited

> [!NOTE]
>
> Inherited from `object`

#### Syntax

```csharp theme={"dark"}
protected internal object MemberwiseClone()
```

#### Returns

Type: `object`

### &#x20;ReferenceEquals Inherited

> [!NOTE]
>
> Inherited from `object`

#### Syntax

```csharp theme={"dark"}
public static bool ReferenceEquals(object objA, object objB)
```

#### Parameters

| Name | Type | Description |
| - | - | - |
| `objA` | `object?` | - |
| `objB` | `object?` | - |

#### Returns

Type: `bool`

### &#x20;ToString Inherited Virtual

> [!NOTE]
>
> Inherited from `object`

#### Syntax

```csharp theme={"dark"}
public virtual string ToString()
```

#### Returns

Type: `string?`


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.