# GlobalPrefixOptions

**Kind:** Interface

**Source:** [`packages/common/interfaces/global-prefix-options.interface.ts`](https://github.com/nestjs/nest/blob/master/packages/common/interfaces/global-prefix-options.interface.ts#L6)

**Part of:** [Common](subsystem-packages-common)

`GlobalPrefixOptions<T>` configures routes that should be excluded when applying a global URL prefix. The generic `exclude` array lets applications provide framework-supported route exclusion definitions, such as path strings or route metadata objects.

## Properties

| Property | Type |
|---|---|
| `exclude` | `T[]` |

## Diagram

```mermaid
graph LR
  A[Application] --> B[Set Global Prefix]
  B --> C[GlobalPrefixOptions<T>]
  C --> D[exclude: T[]]
  D --> E[Routes without global prefix]
  B --> F[All other routes receive prefix]
```

## Usage

```ts
import { GlobalPrefixOptions } from '@nestjs/common';

const prefixOptions: GlobalPrefixOptions<string> = {
  exclude: ['health', 'metrics'],
};

app.setGlobalPrefix('api', prefixOptions);

// /api/users
// /api/orders
// /health
// /metrics
```

## AI Coding Instructions

- Use `exclude` to list routes that must remain accessible without the configured global prefix.
- Match the generic type `T` to the exclusion format accepted by the consuming API, such as `string` or route exclusion metadata.
- Keep operational endpoints such as health checks and metrics routes in `exclude` when external infrastructure expects unprefixed paths.
- Verify excluded paths against registered controller routes; incorrect path values will not bypass the global prefix.

## Used by

2 references from 2 files. Each is a place in this repository where the symbol is actually used — go read one rather than trusting an example.

### Imported by (2)

- `ApplicationConfig` — `packages/core/application-config.ts`:13
- `NestApplication` — `packages/core/nest-application.ts`:54
