Gathering detailed insights and metrics for @nuxt-alt/proxy
Gathering detailed insights and metrics for @nuxt-alt/proxy
npm install @nuxt-alt/proxy
Typescript
Module System
Node Version
NPM Version
58.3
Supply Chain
92.6
Quality
75.3
Maintenance
100
Vulnerability
99.3
License
TypeScript (95.8%)
JavaScript (3.76%)
Vue (0.44%)
Total Downloads
154,384
Last Day
311
Last Week
1,645
Last Month
8,142
Last Year
87,000
25 Stars
23 Commits
5 Forks
2 Watching
1 Branches
2 Contributors
Latest Version
2.5.8
Package Id
@nuxt-alt/proxy@2.5.8
Unpacked Size
16.67 kB
Size
4.63 kB
File Count
14
NPM Version
10.2.3
Node Version
20.10.0
Publised On
18 Jan 2024
Cumulative downloads
Total Downloads
Last day
-30.4%
311
Compared to previous day
Last week
-26.1%
1,645
Compared to previous week
Last month
-5.3%
8,142
Compared to previous month
Last year
32.8%
87,000
Compared to previous year
Proxy module for Nuxt
This serves as an alternative for @nuxtjs-alt/proxy. Please note that this is for nuxt 3 only. The config is similar to what vite has except that this one creates a physical file which is needed for production.
@nuxt-alt/proxy
dependency to your project1yarn add @nuxt-alt/proxy
@nuxt-alt/proxy
to the modules
section of nuxt.config.ts
1export default defineNuxtConfig({
2 modules: [
3 '@nuxt-alt/proxy'
4 ],
5 proxy: {
6 /* module options */
7 }
8});
9
proxies
Object
{}
debug
Boolean
false
(false in prod | true in dev)urls to proxy
experimental.listener
Boolean
false
Enable this to use a nitro plugin that tries to hook onto the server's request and grab the server to listen in production. This is untested in non-node environments.
Nitro hook available after enabling (only in production):
1nitroApp.hooks.hook('listen:node', (server) => {})
1import { defineNuxtConfig } from 'nuxt/config'
2
3export default defineNuxtConfig({
4 modules: [
5 '@nuxt-alt/proxy',
6 ],
7 proxy: {
8 debug: false,
9 experimental: {
10 listener: false
11 },
12 proxies: {
13 // string shorthand
14 '/foo': 'http://localhost:4567',
15 // with options
16 '/api': {
17 target: 'http://jsonplaceholder.typicode.com',
18 changeOrigin: true,
19 rewrite: (path) => path.replace(/^\/api/, '')
20 },
21 // with RegEx
22 '^/fallback/.*': {
23 target: 'http://jsonplaceholder.typicode.com',
24 changeOrigin: true,
25 rewrite: (path) => path.replace(/^\/fallback/, ''),
26 configure: (proxy, options, runtimeConfig) => {
27 // proxy will be an instance of 'http-proxy'
28 },
29 },
30 // Using the proxy instance
31 '/api': {
32 target: 'http://jsonplaceholder.typicode.com',
33 changeOrigin: true,
34 configureWithEvent: (proxy, options, runtimeConfig, event, h3) => {
35 // proxy will be an instance of 'http-proxy'
36 // event will be an instance of the matched url
37 proxy.on('proxyReq', (proxyReq) => {
38 const cookies = h3.parseCookies(event)
39 console.log(cookies)
40 })
41 }
42 },
43 // Proxying websockets or socket.io - Note this only works with `experimental.listener`
44 '/socket.io': {
45 target: 'ws://localhost:5173',
46 ws: true
47 }
48 }
49 }
50})
No vulnerabilities found.
No security vulnerabilities found.