gpt4 book ai didi

proxy - 如何使用 Vercel 设置代理

转载 作者:行者123 更新时间:2023-12-04 08:21:53 30 4
gpt4 key购买 nike

我的 API 在另一个域下运行.. 我正在尝试使用 Vercel 配置代理..
它正在向 /api/test.json 发出请求的应用程序所以我试图......在vercel配置上

"redirects": [
{
"source": "/api/test.json",
"destination": "https://myapi.com/test.json",
}
],
"rewrites": [
{
"source": "/(.*)",
"destination": "/index.html"
}
]
我收到了来自 /api/test.json 的 404

最佳答案

简单地使用重写

"rewrites": [
{
"source": "/api/test.json",
"destination": "https://myapi.com/test.json",
}
]
然后在您的应用程序中
httpAgent
.get('/api/test.json)
.then(res => { console.log(res) })

关于proxy - 如何使用 Vercel 设置代理,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65456701/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com