即使我使用提供的样本:
var express = require('express');
var proxy = require('http-proxy-middleware');
var app = express();
app.use('/api', proxy({target: 'http://www.example.org', changeOrigin: true}));
app.listen(3000);
我启动服务器时的输出是:
node prod-server.js
[HPM] Proxy created: / -> http://www.example.org
我期待:
node prod-server.js
[HPM] Proxy created: /api -> http://www.example.org