AWS S3 上的 Vue 项目返回 405

问题描述 投票:0回答:1

我正在我的 vue 项目中集成支付网关。一切在我的本地服务器上运行良好。但是在 axios POST 上将其部署到 S3 后出现 405 错误。

 const headers = {
    Authorization: "Bearer ...........",
    "Content-Type": "application/json;charset=UTF-8",
    "Access-Control-Allow-Origin": "*",
    "Access-Control-Allow-Headers": "*",
    "Set-Cookie": "HttpOnly;Secure;SameSite=None"
  };

  const body = {
    amount: "119.0",
    .......
    ......
  };

  axios
    .post("/v2/charges", body, { headers })
    .then(response => console.log(response));
}

我在 vue 配置中添加了代理。

devServer: {
  proxy: 'https://api.tap.company/',
}

错误:

chunk-vendors.39b30f6f.js:7 Uncaught (in promise) Error: Request failed with status code 405
    at t.exports (chunk-vendors.39b30f6f.js:7)
    at t.exports (chunk-vendors.39b30f6f.js:13)
    at XMLHttpRequest.h.onreadystatechange (chunk-vendors.39b30f6f.js:57)
vue.js amazon-s3 axios http-status-code-405
1个回答
-1
投票

我也遇到了同样的问题。请问最后怎么解决的?

© www.soinside.com 2019 - 2024. All rights reserved.