[英]Accessing client and server app on diff machine on local network
I want to route client app requests coming from a different machine on my local network, to the server on my dev machine. 我想将来自本地网络上另一台计算机的客户端应用程序请求路由到开发计算机上的服务器。
I have a client side app running on port 8080, and a server app running on port 3000. 我有一个在端口8080上运行的客户端应用程序,以及在端口3000上运行的服务器应用程序。
I am accessing the client app from another machine on the local network using: 我正在使用以下方法从本地网络上的另一台计算机访问客户端应用程序:
machineName:8080
However, the requests from the client app are obviously all being sent to localhost:3000
rather than machineName:3000
. 但是,来自客户端应用程序的请求显然都被发送到localhost:3000
而不是machineName:3000
。
How do I fix this issue? 如何解决此问题?
我必须按照以下步骤在客户端应用程序上转发API请求:
'http://' + window.location.hostname + ':3000'
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.