Kotsu icon indicating copy to clipboard operation
Kotsu copied to clipboard

Minimize amount of redirects for browsers

Open mrhyde opened this issue 8 years ago • 10 comments

Since the way we achieve clean and nice looking URL's is based on how nginx and CloudFlare handle routing we should consider optimizing this process. Currently, we store all content in index.html pages inside of named folder that we are using as URI but accessing this resources causes a browser to do 3 requests before we can get page content!

  1. Check if https://example.com/site/url exists (it's not)
  2. Follow to new resource location that was specified in response header of the first request, http://example.com/site/url/ (note trailing slash and HTTP protocol)
  3. Follow to HTTPS location of the same page (CloudFlare rewrite)

Possible solutions:

  • [ ] Configure our nginx server to use HTTPS (probably using Let's Encrypt). This will cut one redirect.
  • [x] Always use (or cut) trailing slash in links to avoid another redirect

P.S. Just to specify that we are talking 10-100ms of delays for page render so it's not a critical issue.

mrhyde avatar Feb 24 '17 15:02 mrhyde