devtools: {
enabled: true
},
nitro: {
devProxy: {
'/api': {
target: 'http://33.149.255.263:8000',
changeOrigin: true
}
}
}如上所示,使用代理转换ip,然后我代码里使用$fetch("/api/user/create"),正常应该是要转换成请求“http://33.149.255.263:8000/api/user/create”,但实际是一直请求http://localhost:3000/api/user/create,各位大佬有用过的吗?请教下
nitro.devProxy 主要用于开发环境下的客户端请求代理。如果在服务端(SSR)中使用 $fetch,它可能不会走代理,因为SSR本身不受跨域限制。