We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Client not following redirects
const undici = require("undici"); const dispatcherOpts = { maxRedirections: 1, }; const requestOpts = { method: "GET", origin: "https://imgur.com", path: "/qRKTc1U.jpeg", }; new undici.Agent(dispatcherOpts) .request(requestOpts) .then(({ statusCode, headers }) => { console.log("Agent:", statusCode, "\n", headers); }) .catch(console.error); new undici.Client(requestOpts.origin, dispatcherOpts) .request(requestOpts) .then(({ statusCode, headers }) => { console.log("Client:", statusCode, "\n", headers); }) .catch(console.error);
It should follow the redirect
Agent: 200 { connection: 'keep-alive', 'content-length': '451104', 'content-type': 'image/jpeg', 'last-modified': 'Mon, 22 May 2023 13:33:03 GMT', etag: '"bf7cfe5aa4341b0761cab33d795c539f"', 'x-amz-storage-class': 'STANDARD_IA', 'x-amz-server-side-encryption': 'AES256', 'x-amz-cf-pop': 'IAD12-P2', 'x-amz-cf-id': '0PT3Lf5C_pPRg_IyvPvm_mYlrK_DDZH7QayqRmKuzJndkgH_nhrXVg==', 'cache-control': 'public, max-age=31536000', 'accept-ranges': 'bytes', age: '54681', date: 'Wed, 01 May 2024 11:30:03 GMT', 'x-served-by': 'cache-iad-kcgs7200020-IAD, cache-bur-kbur8200095-BUR', 'x-cache': 'Miss from cloudfront, HIT, HIT', 'x-cache-hits': '2, 0', 'x-timer': 'S1714563003.252339,VS0,VE1', 'strict-transport-security': 'max-age=300', 'access-control-allow-methods': 'GET, OPTIONS', 'access-control-allow-origin': '*', server: 'cat factory 1.0', 'x-content-type-options': 'nosniff' } Client: 301 { connection: 'close', 'content-length': '0', 'retry-after': '0', location: 'https://i.imgur.com/qRKTc1U.jpeg', 'accept-ranges': 'bytes', date: 'Wed, 01 May 2024 11:30:04 GMT', 'x-served-by': 'cache-fra-eddf8230146-FRA', 'x-cache': 'HIT', 'x-cache-hits': '0', 'x-timer': 'S1714563005.568657,VS0,VE0', server: 'cat factory 1.0', 'strict-transport-security': 'max-age=300', 'cache-control': 'no-store, no-cache, must-revalidate, post-check=0, pre-check=0', 'x-frame-options': 'DENY', 'access-control-allow-origin': 'https://imgur.com', 'access-control-allow-credentials': 'false' }
undici@6.15.0 Node.js v22.0.0
The text was updated successfully, but these errors were encountered:
It can't. The Client can only talk to 1 origin, so it can't follow redirects.
You can add single host redirects with https://github.com/nodejs/undici/blob/main/docs/docs/api/Dispatcher.md#example-1---basic-compose
Sorry, something went wrong.
No branches or pull requests
Bug Description
Client not following redirects
Reproducible By
Expected Behavior
It should follow the redirect
Logs & Screenshots
Environment
undici@6.15.0
Node.js v22.0.0
The text was updated successfully, but these errors were encountered: