ssrwpo / ssr

SSR - Router with SSR for Node & Meteor
https://ssrwpo.github.io/ssr/
MIT License
93 stars 16 forks source link

i18n not working with cache key #66

Closed gbhrdt closed 7 years ago

gbhrdt commented 7 years ago

I know you're switching to react-intl, but it's not published right now. There is a bug with routes that have the same path but different languages (which are detected via cookie or header).

I temporarily fixed this for us by adding req.language to the platform variable here: https://github.com/ssrwpo/ssr/blob/0f82fed102f7267231c9e79c36b11e54c85505af/src/server/steps/cacheAnalysis.js#L11

I think, the nicest solution would be adding the language to the cache key.

cbilotta commented 7 years ago

From what I know, google doesn't really like you detecting the language anyways and prefers that you use a subdomain, or a directory in the url.

But I might be wrong. If you use this for an app, it's a different story, since google doesn't index it anyways. But in this case, there is no use for SSR, and so the cache is useless anyways :)