---
title: No Server Import In Page
url: "https://nextjs.org/docs/messages/no-server-import-in-page"
docs_index: /docs/llms.txt
---



> Prevent usage of `next/server` outside of `proxy.js`.

## Why This Error Occurred

`next/server` was imported outside of `proxy.{js,ts}`.

## Possible Ways to Fix It

Only import and use `next/server` in a file located within the project root directory: `proxy.{js,ts}`.

```ts filename="proxy.ts"
import type { NextFetchEvent, NextRequest } from 'next/server'

export function proxy(req: NextRequest, ev: NextFetchEvent) {
  return new Response('Hello, world!')
}
```

## Useful Links

- [Proxy](/docs/pages/api-reference/file-conventions/proxy)
