鍍金池/ 問答/網(wǎng)絡(luò)安全  HTML/ vue axios post數(shù)據(jù)報錯504

vue axios post數(shù)據(jù)報錯504

vue文件:

axios.post('/api/nameCheck', {
                name: this.ruleForm2.name
              })
              .then(function (response) {

config/index.js:(target改過本機(jī)ip:3000和127.0.0.1:3000均失?。?/p>

proxyTable: {
         '/api': {
            target: 'http://localhost:3000/',
            changeOrigin: true,
            // pathRewrite: {
            //   '^/api': ''
            // }
        }
    },

server/app.js:

var users = require('./routes/users');
app.use('/api', users);

routes/users:

router.post('/nameCheck', function(req, res, next) {
    
    return res.send('totally');
});

報錯:POST http://localhost:8089/api/nameCheck 504 (Gateway Timeout)
(node后端已打開,用localhost:3000可以正常訪問)
[HPM] Error occurred while trying to proxy request /api/nameCheck from localhost:8089 to http://175.8.15x.xx:3000/ (ECONNREFUSED) (https://nodejs.org/api/errors...
(ECONNREFUSED)

(其實昨天還能連接上的,不知道為什么今天就連不上了。。)
請問有具體的解決辦法嗎?

回答
編輯回答
有點壞

504 是網(wǎng)關(guān)問題 你前端hold不住的 去你的后臺

2018年4月24日 19:19
編輯回答
忠妾

昨天能連上,那么可以從你今天改動的代碼去排查

2017年11月6日 20:31