Open
Description
Perhaps I'm using the library incorrectly, or unaware of its limitations- but I recently found that I've had to put http-proxy-middleware as the last middleware in my express config.
Expected behavior
If possible, http-proxy-middleware should call the next()
middleware. If not, the behavior should be documented.
Actual behavior
middlewares that follow http-proxy-middleware are not executed
Setup
app.use('*', [
(req, res, next) => {
console.log('I do get executed');
next();
},
proxy({ ...proxyOptions }),
(req, res, next) => {
console.log('I do not get executed');
next();
}
]);
- http-proxy-middleware: 0.17.4
- server: express + 4.16.2
proxy middleware configuration
var apiProxy = proxy({
target:'http://www.example.org',
changeOrigin:true,
secure: false
});
server mounting
const https = require('https');
const express = require('express');
const app = express();
const certs = require('./getCertOptions')();
const middlewares = require('./getExpressMiddlewares')();
app.use('*', middlewares);
https.createServer({ certs }, app).listen(5443);
Metadata
Metadata
Assignees
Labels
No labels