front-end Vue.js app in Kubernetes docker container cannot connect to back-end

前端 未结 1 1995
-上瘾入骨i
-上瘾入骨i 2021-01-14 13:50

I have built a front-end Vue.js application, running on a docker container under kubernetes environment. the backend is also in the same kubernetes cluster (I am using Minik

相关标签:
1条回答
  • 2021-01-14 14:22

    Your front-end vue.js application is just hosted in the container. The application is actually run from the browser of the client. Your backend which functions as the API will also need to be accessible to the browser of the client. The communication between frontend and backend doesn’t go through the container of the frontend, but directly from the client to the backend.

    The connection between the front-end container and backend container is not used/needed in this case since you're not rendering anything from the front-end container, before responding to the client. If you were using a server-side rendering technology, such as PHP, Django, .net, Nodejs, etc., whereby you needed to connect to the backend to get some data and render something before replying to the client, then the connection between the front-end container and the backend container would be relevant.

    Your current setup is no different from hosting your application/code on a CDN and accessing the API hosted on a separate service(publicly available).

    0 讨论(0)
提交回复
热议问题