This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.
https://fetch.spec.whatwg.org/#concept-request-manual-redirect-flag [[ manual redirect flag ]] It would be nice if we had a mechanism of setting this (or anything like it) when calling into `fetch()`. This would give us the ability to mitigate certain risks by ensuring that data meant for one location isn't accidentally redirected to another.
Tentative proposal: errorOnRedirect = false as we cannot expose redirects directly which the "manual redirect flag" does (and is needed for internal algorithms such as "navigate"). When this property is set we'd set the manual redirect flag and reject with a TypeError if a redirect of sorts is returned. It will also be reflected on Request of course.
Sounds fine to me. My only requirement is the ability to assert that a particular request will touch _only_ a specific URL, and will otherwise fail. I'm happy with any mechanism you're happy with that achieves that result. [insert questions about service workers here]
Oh, you want to make such an assertion from a document with a service worker not being able to affect it? Because that would be impossible as far as I can tell.
(In reply to Anne from comment #3) > Oh, you want to make such an assertion from a document with a service worker > not being able to affect it? Because that would be impossible as far as I > can tell. If it wasn't impossible, yes! I'd love that! :)
Manual redirect flag is now a mode: https://github.com/whatwg/fetch/commit/83981498175633510878ebf97077ec632ceedc29 My plan is to expose "follow" and "error" to JavaScript and leave "manual" for HTML's navigate algorithm and any future controlled request context algorithms. Judging from RequestInit today, it would be something like: .redirect = "error"
*** Bug 26238 has been marked as a duplicate of this bug. ***
https://github.com/whatwg/fetch/commit/b6b4f87048020cda6237ca4af02df62d43f99765