🐛 fix(vite.config.ts): remove /api/v1 prefix from proxy target URL
✨ feat(vite.config.ts): add rewrite function to proxy configuration to add /api/v1 prefix to requests The /api/v1 prefix was removed from the proxy target URL as it was already being added by the rewrite function. The rewrite function was added to the proxy configuration to add the /api/v1 prefix to requests, which is required by the backend API. Fixes #458
This commit is contained in:
parent
eac5057d4f
commit
51ecc05563
1 changed files with 2 additions and 1 deletions
|
|
@ -11,7 +11,7 @@ const apiRoutes = [
|
|||
];
|
||||
|
||||
// Use environment variable to determine the target.
|
||||
const target = process.env.VITE_PROXY_TARGET || "http://127.0.0.1:7860/api/v1";
|
||||
const target = process.env.VITE_PROXY_TARGET || "http://127.0.0.1:7860";
|
||||
|
||||
const proxyTargets = apiRoutes.reduce((proxyObj, route) => {
|
||||
proxyObj[route] = {
|
||||
|
|
@ -19,6 +19,7 @@ const proxyTargets = apiRoutes.reduce((proxyObj, route) => {
|
|||
changeOrigin: true,
|
||||
secure: false,
|
||||
ws: true,
|
||||
rewrite: (path) => `/api/v1${path}`,
|
||||
};
|
||||
return proxyObj;
|
||||
}, {});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue