useNitroOrigin()

A runtime safe way of accessing the Nitro origin, within Nitro.

Same as useNitroOrigin() but you will need to provide the request context.

Usage

serverMiddleware.ts
import { useNitroOrigin } from '#imports'

export default defineEventHandler((e) => {
  const origin = useNitroOrigin(e)
  // https://www.example.com
})
Did this page help you?