Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

修改接口请求域名 #35

Closed
zhuqiming opened this issue Feb 6, 2024 · 1 comment
Closed

修改接口请求域名 #35

zhuqiming opened this issue Feb 6, 2024 · 1 comment

Comments

@zhuqiming
Copy link

如何自定义api请求的接口地址域名,项目启动默认是localhost:4000, 但是后端服务监听8080端口提供api接口,目前配置一个api:/a/b,完整请求地址:http://127.0.0.1:4000/a/b,如何调整成http://127.0.0.1:8080/a/b

@cstongwei
Copy link

可以配置代理。在vite.config.js文件里添加配置
proxy: {
"/admin": {
target: env.VITE_API_URL,
// target: "http://127.0.0.1:8050/",
changeOrigin: true,
rewrite: (path) => path,
},
}
image

@iceqing iceqing closed this as completed Feb 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants