SvelteKit Docker fetch issue #11890
-
I have searched for many hours but haven't found any answer to this problem: I have 2 docker containers. One with FastAPI backend and one with Sveltekit app. Sending requests with openapi docs is ok. Pages are rendered fine. Sveltekit with npm run dev works fine too. But SvelteKit fetch (in +page.server.js) in docker container throws error (no error on local machine)
Vite config
Changing http://api:8000 to localhost:8000 / localhost had no effect. I tried Creating additional express server and passing handler.js didn't work too. Using nginx didn't help either |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Vite |
Beta Was this translation helpful? Give feedback.
-
Thanks for your response. I added this to hooks.server.js and it worked!
Where api is name of docker container |
Beta Was this translation helpful? Give feedback.
Vite
server.proxy
only works during dev. For production, see How do I use a different backend API server?