A http proxy module for nuxt(3) powered by h3-proxy.
npm install nuxt-proxy-requestA http proxy module for nuxt(3) powered by h3-proxy .
- See this issue Error when starting a Project using "http-proxy-middleware" with "npm run start" #15608.
- Support for both development and production environments.
- Almost the same API as nuxt-proxy that using http-proxy-middleware, But this module using h3-proxy .
- Support Typescript.
1. Add nuxt-proxy-request dependency to your project
``bashUsing pnpm
pnpm add -D nuxt-proxy-request
2. Add
nuxt-proxy-request to the modules section of nuxt.config.ts`js
export default defineNuxtConfig({
modules: [
'nuxt-proxy-request'
],
proxy: {
options: [
{
target: 'http://www.example.com',
pathFilter: ['/api/**'],
pathRewrite: {
'^/api': ''
}
}
]
}
// OR
// runtimeConfig: {
// proxy: {...}
// }
})
`That's it! You can now use nuxt-proxy-request in your Nuxt app ✨
Options
| Key | Type | Default value | Description |
| :---: | :---: | :---: | :---: |
|
options | object/Array