Websites normally employ several redirects to avoid duplicate content pages etc for SEO purposes. The following is the behaviour I found easiest to setup and most consistently used on the web. It also aligns well with the behaviour popular tools like nginx / apache / wordpress. The key is consistency.
http://(.*) -> 301 https://$1
Exceptions can be made of course for HTTP only sites sitting behind reverse proxies.
<link rel="canonical" href="https://example.com/" />
<link rel="canonical" href="https://example.com/images/" />
<link rel="canonical" href="https://example.com/blog/life/how-i-turned-water-into-gold/" />
Always try to redirect in 1 hop if possible. Make sure you never hop to HTTP and then back to HTTPS! (common mistake with reverse proxy setups).
https://example.com/image -> 301 https://example.com/images/
https://example.com/blog/life/how-i-turned-water-into-gold -> 301 https://example.com/blog/life/how-i-turned-water-into-gold/
https://example.com/image/logo.png?v=1 200
https://example.com/image/info.txt 200
https://example.com/home/?lang=en 200
https://example.com/home?lang=en -> 301 https://example.com/home/?lang=en
Nothing to do here, browser will auto handle this for us.
https://example.com/thisdoesntexist 404 (no redirect hop to trailing slash)
https://example.com/api/user/1 200
https://example.com/api/user/1/preferences 200
https://example.com/api/user/1/ 404 (should be no trailing slash!)