-
-
Notifications
You must be signed in to change notification settings - Fork 688
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Bug Description
Since version seven (or six I didn't test) the maxRedirections option do not work anymore (redirections are not followed anymore).
Reproducible By
Here is a minimal reproduction I made using undici 7.11.0 and fastify. The redirection work using undici v5.29.0
index.js
import undici from "undici";
import { createServer } from "./server.js";
await using server = createServer();
await server.listen({ port: 3000 });
const response = await undici.request("http://localhost:3000/redirect", {
method: "GET",
maxRedirections: 1
});
const data = await response.body.text();
console.log({
data,
statusCode: response.statusCode,
headers: response.headers
});server.js
import fastify from "fastify";
export function createServer() {
const server = fastify({ logger: false });
server.get("/", async() => {
return {
uptime: process.uptime()
};
});
server.get("/redirect", (_, reply) => {
reply.redirect("/");
});
server[Symbol.asyncDispose] = async() => {
await server.close();
}
return server;
}Expected Behavior
Follow the redirections
Environment
Node.js v22.x and v24.x
There is probably a breaking that I missed but I wonder why maxRedirections is still available.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working