【问题标题】:axios.post gives error on my VPS when sending post request locally to another app. Everything works fine on my local computeraxios.post 在本地向另一个应用程序发送帖子请求时在我的 VPS 上出现错误。在我的本地计算机上一切正常
【发布时间】:2017-10-11 00:44:46
【问题描述】:

所以我有一个 Nginx 配置为通过端口 433 (SSL) 将请求转发到正在运行 react 的 localhost:3000,react 应依次将请求发布到在同一 VPS (localhost:8080) 上运行的 Node.js 应用程序到进行条带付款。

到目前为止一切正常。前端正在渲染,SSL 工作。

但是当我使用来自 React 的付款数据运行 axios.post 时,它永远不会到达节点(据我的日志告诉我)。

我在节点中设置了 CORS,以接受一堆“localhost”变体和实际域本身。

为什么这不起作用? 谢谢!

【问题讨论】:

    标签: node.js reactjs nginx axios


    【解决方案1】:

    对不起,我应该将 React 应用程序指向 api 的 Url,而不是它在我的 VPS 上的本地地址。

    【讨论】:

      猜你喜欢
      • 2021-06-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-09-24
      • 2019-12-11
      • 2018-03-18
      • 2021-12-19
      • 2014-03-01
      相关资源
      最近更新 更多