Frontend Unable to Connect to Backend in Kubernetes and Docker Deployments: Requests Default to Localhost #293
-
We attempted to deploy Dataline to our Kubernetes environment, but it’s not working as expected. It appears that I can access the frontend through the custom domain, but the connections from the frontend are being blocked. The frontend is trying to send requests to http://localhost:7377 for health checks and other operations. We also tried running Dataline on a VM using docker run and accessed the web interface via the VM’s IP address. The result was the same: we could reach the frontend, but the frontend couldn’t connect to the backend, as it was still trying to send requests to localhost. Additionally, we tried setting the ALLOW_ORIGINS environment variable to include our custom domain, but it doesn’t seem to have any effect. How can I change the default domain for the backend? It should match the custom domain I use to access the frontend, rather than defaulting to localhost. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 7 replies
-
There's a frontend variable for the backend host as well! Set "VITE_API_URL" to point to your backend. We might not have documented I'll double check. Allowed origins is only important to set if you're using authentication. Let me know if that works! |
Beta Was this translation helpful? Give feedback.
-
Hey @nick1ee, thanks for raising the issue. I've looked into it and am working on a fix. The problem is that the docker image serves the frontend app via the backend, and it serves the bundle that was packaged during the docker image build, so it has no way of seeing what the environment variable is at any time. For the time being, I suggest you do this until the proper fix is released:
I've tried it out myself and can confirm that I was able to open the app using a custom url. The proper fix will be done soon but I can't guarantee when the next release will happen. Hope this helps! Edit: Don't forget to set the |
Beta Was this translation helpful? Give feedback.
-
Support for this is now in the latest release FYI! Try it out and let us know if any problem remains 🙂 Thanks for bringing this up and helping us improve! |
Beta Was this translation helpful? Give feedback.
Hey @nick1ee, thanks for raising the issue. I've looked into it and am working on a fix. The problem is that the docker image serves the frontend app via the backend, and it serves the bundle that was packaged during the docker image build, so it has no way of seeing what the environment variable is at any time.
For the time being, I suggest you do this until the proper fix is released:
docker build --build-arg API_URL="http://localhost:7376" -t dataline .
. Of course you should replacehttp://localhost:7376
with your own value.