What is Redirect Time?
- Redirect time measures the amount of time it takes a request to follow a redirect.
- May also refer to “total redirect time” which is the time taken to follow all redirects.
Redirect time for a single redirect can be calculated using redirectEnd – redirectStart in the Navigation timing API.
Total redirect time
Some performance tools will define “redirection time” more broadly. For example, by measuring from the beginning of navigation to the beginning of the fetch.
This represents a measure of the actual time it takes to follow all redirects including the DNS lookup time and application cache lookups as there may be many redirects represented in the total redirection time.
Why is redirect time measured?
Redirects can cause significant delays in rendering a webpage.
Understanding the time taken on redirects not only provides a more accurate understanding of user experience, it also can help motivate decision makers to control the way their resources use redirects more tightly.
Redirects affect resources much more often than is normally understood.
Common redirects found
Redirects are used widely by webmasters. In fact most webpages will have redirects such as…
- Canonical (www.example.com vs example.com)
- SSL – secure pages redirect (can be removed by using HSTS)
- Redirects to mobile version
- Content driven redirects
Common redirect problems
- Multiple redirects in chain
- Resources called from HTML using URLs which require redirects
- Unnecessary redirects
How redirect time can be optimized
- Removing redirects where possible
- Reducing amount of redirects when they can not be removed entirely
- Auditing redirects to ensure they are not creating redirect chains
- Using relative paths or correct paths to call external resources in a manner which does not require a redirect