Vite proxy doesnt work with api request to a local server running in docker #9285
-
My app is running locally on a vite dev server. I want to proxy my api requests to another local server running in docker, but approaches described in documentation don't help. When trying to request api, I get cors error
vite configuration:
api request:
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 7 replies
-
import axios from 'axios'
export const getConfigs = async () => {
try {
console.log(await axios.get("/api/v1/configurations")) // "http://localhost:3000/api/v1/configurations"
} catch (e) {
console.log(e)
}
} |
Beta Was this translation helpful? Give feedback.
-
Hii i have a question like...in my vite.config.js...when i am setting up proxy...its working fine....but after production....its not working |
Beta Was this translation helpful? Give feedback.
server.proxy
proxies request from Vite to the target. So you should request to Vite server.