Title: lab-ops-hub: redirect policy diverges between crawlers — Worker fallback caps at 5 hops and follows any 3xx, container follows 10 hops and only 301/302/303/307/308 · Issue #571 · developing-today/code · GitHub
Open Graph Title: lab-ops-hub: redirect policy diverges between crawlers — Worker fallback caps at 5 hops and follows any 3xx, container follows 10 hops and only 301/302/303/307/308 · Issue #571 · developing-today/code
X Title: lab-ops-hub: redirect policy diverges between crawlers — Worker fallback caps at 5 hops and follows any 3xx, container follows 10 hops and only 301/302/303/307/308 · Issue #571 · developing-today/code
Description: Summary The two lab-ops-hub crawlers disagree on redirect policy, so the same public URL can succeed via one crawler and fail via the other — and the Worker fallback (which exists to stand in when the container is unavailable) does not r...
Open Graph Description: Summary The two lab-ops-hub crawlers disagree on redirect policy, so the same public URL can succeed via one crawler and fail via the other — and the Worker fallback (which exists to stand in when ...
X Description: Summary The two lab-ops-hub crawlers disagree on redirect policy, so the same public URL can succeed via one crawler and fail via the other — and the Worker fallback (which exists to stand in when ...
Opengraph URL: https://github.com/developing-today/code/issues/571
X: @github
Domain: github.com
IPv4 address: 140.82.114.4
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"lab-ops-hub: redirect policy diverges between crawlers — Worker fallback caps at 5 hops and follows any 3xx, container follows 10 hops and only 301/302/303/307/308","articleBody":"## Summary\n\nThe two lab-ops-hub crawlers disagree on redirect policy, so the same public URL can succeed via one crawler and fail via the other — and the Worker fallback (which exists to stand in when the container is unavailable) does not reproduce the container's behaviour.\n\n## Evidence (verified 2026-10-22, on main `7a9ac873`)\n\n**Redirect-count limit**\n- Worker fallback: `fetchFollowingValidatedRedirects` defaults to `maxRedirects = 5` (`pkgs/lab-ops-hub/src/lib.ts:204`, error at lib.ts:216-218).\n- Container: `_ValidatingRedirectHandler` (`pkgs/lab-ops-hub/container/app.py:389-396`) subclasses urllib's `HTTPRedirectHandler` and inherits its defaults: `max_redirections = 10`, `max_repeats = 4`.\n\n**Redirect status codes**\n- Worker fallback follows *any* 3xx response that carries a `Location` header (lib.ts: `res.status >= 300 && res.status \u003c 400`).\n- urllib's handler only treats 301, 302, 303, 307 and 308 as redirects; any other 3xx raises `HTTPError`, which the container's `do_POST` surfaces as a 502.\n\n**Reproduction (both sides run this run)**\n- A 7-hop chain of 302s between public URLs, ending in 200:\n - Worker fallback (real `fetchFollowingValidatedRedirects` under `bun test` with a scripted fetcher): `Error: too many redirects (more than 5)`.\n - Container redirect handler (urllib opener against a local server): `200`.\n- A single 300 Multiple Choices response with a `Location` pointing at a public 200 page:\n - Worker fallback: follows it, returns `200`.\n - Container: `HTTPError 300` → `/crawl` returns 502.\n\n## Why it matters\n\n`/api/crawl` tries the container first and silently falls back to the Worker on any container error (src/index.ts `crawlWithContainer` / catch → `crawlFallback`), recording only `source` in the result. Redirect-heavy public pages (shorteners, AMP/print chains, locale negotiation) therefore crawl or fail depending on which backend happened to serve the request, and a 6–10-hop page that the container handles fine hard-fails whenever the container is cold or down — exactly when the fallback is supposed to be equivalent. This is the same class of Worker/container divergence fixed for URL validation (#460, #474, #481, #500, #529, #567) and extraction (#569); redirect policy is the remaining unaligned piece.\n\n## Acceptance criteria\n\n- One redirect policy stated in one place both implementations follow: a single hop limit and a single set of followed status codes (suggested: align the Worker to the container's urllib semantics — 10 hops, codes 301/302/303/307/308 — or pick 5 deliberately and enforce it in the container handler too; either way the two must match, including a repeat/loop rule equivalent to urllib's `max_repeats`).\n- The container handler sets its limits explicitly rather than relying on urllib defaults, so a Python/urllib default change cannot silently re-open the divergence.\n- Tests on both sides pin the shared policy: a chain one hop over the limit fails identically, a chain at the limit succeeds identically, and a non-followed 3xx (e.g. 300/304 with `Location`) is handled identically (TS tests in `pkgs/lab-ops-hub/test/lib.test.ts`, Python tests alongside `test/test_container_validate.py` or a new container redirect test file).\n- Per-hop SSRF re-validation of every redirect target is unchanged on both sides (#460).\n","author":{"url":"https://github.com/dezren39","@type":"Person","name":"dezren39"},"datePublished":"2026-10-22T08:22:52Z","url":"https://github.com/developing-today/code/issues/571"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:bb7e7c1d-276f-a0dd-1f3d-2fff331e132a |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | BCF8:3373A3:D2C16F:10F2840:6B064149 |
| html-safe-nonce | f79aa2d9ba7654738568372614186f0d568ea12e38d3986fefabdbf4b7b0feeb |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCQ0Y4OjMzNzNBMzpEMkMxNkY6MTBGMjg0MDo2QjA2NDE0OSIsInZpc2l0b3JfaWQiOiI0ODk2MjYwOTg0MDY4Nzg0NDU3IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 3d90699f71f86f27d314ed9ef465917c30b8a71e4c35d9357655fadc65e7d683 |
| hovercard-subject-tag | issue:5975758523 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/developing-today/code/571/issue_layout |
| twitter:image | https://opengraph.githubassets.com/27df8b51978cb8cc0811ed240641c1da6a232781749b3975803188ef3164acc9/developing-today/code/issues/571 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/27df8b51978cb8cc0811ed240641c1da6a232781749b3975803188ef3164acc9/developing-today/code/issues/571 |
| og:image:alt | Summary The two lab-ops-hub crawlers disagree on redirect policy, so the same public URL can succeed via one crawler and fail via the other — and the Worker fallback (which exists to stand in when ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | dezren39 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 1bff4f6bfaa96dc9c42cacf315424c24ebb548b06142ced5e3aaccb2a42dd652 |
| turbo-cache-control | no-preview |
| go-import | github.com/developing-today/code git https://github.com/developing-today/code.git |
| octolytics-dimension-user_id | 26439447 |
| octolytics-dimension-user_login | developing-today |
| octolytics-dimension-repository_id | 627308783 |
| octolytics-dimension-repository_nwo | developing-today/code |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 627308783 |
| octolytics-dimension-repository_network_root_nwo | developing-today/code |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | ac613d3698d3d8565651455086e1f74da07bf277 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width