且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

错误OPTIONS net :: ERR_CONNECTION_REFUSED

更新时间:2021-07-01 20:55:55

可以肯定的是,这是一个后端问题.当后端和前端之间的跨源通信未正确连接时,会发生这种情况.考虑到您已经导入了cors并设置了中间件,很可能在源URL和请求URL方面使用PUT方法都犯了一个错误.

One thing is for sure, this is a backend problem. This happens when the cross origin communication between the backend and frontend is not connected properly. Considering you have imported cors and set up the middleware, most probably you have made a mistake using the PUT method in terms of the origin URL and request URL.

您可以做的事情:

1)确保两个服务器(后端和前端)都在运行.

1) Make sure both servers are running (the back-end and front end).

2)查看Google开发工具并查看网络部分.查看请求标头和常规标头.确保请求URL/后端具有您的后端服务器URL,并且 orgin/frontend 具有您的前端URL.

2) Look into google development tool and see the network section. Look at the request headers and the general. Make sure the request URL / backend has your backend server URL and the orgin / frontend has your frontend URL.

3)确保在您的http.put()方法中,要为其喂入的域与您在服务器中设置的api匹配.

3) Make sure in your http.put() method, the domain you are feeding it matches the api you set up in your server.

4)您的问题是后端未正确连接到前端,因此请不要浪费时间尝试查找其他错误.专注于调试http.put()方法以及已导入的cors模块和中间件.

4) Your issue is that your backend is not connected with your front end properly,so don't waste your time trying to find other errors. Focus on debuging the http.put() method and the cors module and middleware you have imported.