-
Notifications
You must be signed in to change notification settings - Fork 10
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
When the target has query params AND ignorePath option is set, they are completely omitted when the server actually proxies the request. In http-proxy, the query parameters are still sent, just the actual request's path is not added.
Steps to Reproduce
Start with a simple server on port 8081 logging the url:
import { createServer } from 'http';
const server = createServer((req, res) => {
console.log(req.url);
res.end('OK');
});
server.listen(8081);Then, create a proxy server on port 8080, to receive the request, and proxy to the server on port 8081:
import { createServer } from 'http';
import { createProxyServer } from 'http-proxy-3';
const proxyServer = createProxyServer({
target: 'http://localhost:8081/test?query=test',
ignorePath: true,
});
const server = createServer((req, res) => {
proxyServer.web(req, res);
});
server.listen(8080);With http-proxy-3, the server on port 8081 outputs: /test, whereas with http-proxy (and http-proxy-node16), the server outputs /test?query=test. Interestingly enough, this bug also exists in httpxy.
Note that without ignorePath: true, the query params pass through fine. Let me know if this is actually intended behaviour, thanks!
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working