Kotsu
Kotsu copied to clipboard
Minimize amount of redirects for browsers
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!
- Check if
https://example.com/site/url
exists (it's not) - 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) - 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.