-
Couldn't load subscription status.
- Fork 1.8k
Open
Labels
A-redirectArea: the HTML redirect tableArea: the HTML redirect tableC-bugCategory: A bug, incorrect or unintended behaviorCategory: A bug, incorrect or unintended behavior
Description
Problem
If a redirect chain ends in a loop, the browser will reload the pages indefinitely.
Steps
Set up a redirect loop, such as the following:
[output.html.redirect]
"/chapter_1.html#a" = "chapter_2.html#b"
"/chapter_2.html#b" = "chapter_1.html#a"with a SUMMARY.md:
# Summary
- [Chapter 1](./chapter_1.md)
- [Chapter 2](./chapter_2.md)Navigate to chapter_1.html#a
Possible Solution(s)
I'm not sure exactly what should be done. One thing to consider is that loops can happen in between books. Some ideas:
- During book building, detect a loop and report an error.
- When redirecting, use some mechanism to track the number of redirects. I don't know what this would look like, but url query parameters, cookies, or localstorage are some potential options. It looks like browsers allow roughly 20 redirects (when using http redirects).
Notes
No response
Version
mdbook v0.5.0-alpha.1
Metadata
Metadata
Assignees
Labels
A-redirectArea: the HTML redirect tableArea: the HTML redirect tableC-bugCategory: A bug, incorrect or unintended behaviorCategory: A bug, incorrect or unintended behavior