请需要您的帮助。 我有一个带有 reactJs 的应用程序,在 localhost 中执行是正确的,但在 Deploy 中使用 Heroku 错误:
我的代码:
const httpsAgent = new https.Agent({ rejectUnauthorized: false });
const session_url = '/oo/rest/executions'
var username = 'myUsername'
var password = 'myPass'
axios.post(session_url, sendRequest, {
Access: false,
withCredentials: true,
auth: {
username: username,
password: password
},
httpsAgent: httpsAgent,
headers: {
"Accept": "application/json",
"Content-Type": "application/json"
}
})
使用 http-proxy-middleware 代理:
const { createProxyMiddleware } = require('http-proxy-middleware');
module.exports = function(app) {
app.use(
'/oo/rest/executions',
createProxyMiddleware({
target: 'https://myProxy.com/3000',
secure: false,
changeOrigin: true,
})
);
};
我不知道如何使请求在 Heroku 中工作。