Cookie based redirect/rewrite
In my static app I’m storing language info on localeStorage. My urls are like this:
/ -> home page with default locale
/ch -> home page with chinese locale
If user visited my app before and set locale to chinese then visits homepage “/” without “/ch” he is redirecing to “/ch” as soon as possible on client side code. Until I read localeStorage then redirect, user sees default locale. Reading locale from cookie and 302 redirect would be better.
My app also redirects visitors to their browser language path if they are at trying to access “/” and if didnt explicitly select another locale. Reading browser locale from window.navigator.language. Instead of doing that i would prefer read “accept-language” header then 302 redirect.