WebPagetest Forums
speeding up redirect - Printable Version

+- WebPagetest Forums (https://www.webpagetest.org/forums)
+-- Forum: Web Performance (/forumdisplay.php?fid=3)
+--- Forum: Optimization Discussions (/forumdisplay.php?fid=5)
+--- Thread: speeding up redirect (/showthread.php?tid=12136)

speeding up redirect - Torsten Robitzki - 03-23-2013 06:24 AM

if I got it right, a redirect can contain a message body. Would it make sense to include some <script src="a.js"> tags in the response body, if I know that the script will be loaded by the redirect target page?

If a browser would parse the body and maybe even read the message body and fetch the java script file (assumed cacheable by the browser), the browser may have the script already, before it can parse the redirect target and find there, that a.js have to be read from the server.

Are there any good, best practices to speed up redirects (beside getting rid of redirects)?

kind regards,


RE: speeding up redirect - pmeenan - 03-27-2013 12:03 AM

I'm fairly certain that browsers will not execute anything that you send in the body of a 301/302 response. They will see the location directive and start fetching the new page right away.

The only things I'm aware of for speeding up redirects:

- make them cacheable (301 instead of 302)
- if you are redirecting across domains, http://www.example.com -> example.com, if http://www.example.com is a cname to example.com then the DNS lookup for the new domain should be a lot faster