I’m building a static multilingual website, using the proxy strategy explained here :
Each lang has it’s own site generated on netlify (same repo, different env var)
I have one https://site.com on netlify, wich is the default language, with my custom domain pointing to it.
And all the other langs has their own netlify name : https://site-lang.netlify.app
I use proxy rules on the main site.com to point site.com/lang to the related site-lang.netlify.app. /lang/* https://site-lang.netlify.app/:splat 200
But this redirect should be based on the request origin to avoid loop redirects. I can’t just set : https://site-lang.netlify.app https://site.com/lang 301!
=> Too many redirects
Is there a way to do that with netlify redirects ?
Or is there a better way to handle that ?
Then make sure your that redirect only occurs if the request does not originate from your custom domain. Finally, it would be helpful for us and other community members if you could share your repo?
Thanks for your answer, althought I’m not sure I understand it correctly.
I don’t really want the country based auto redirect, and as I see it this would still be a loop redirect as I don’t know how to make sure this redirect don’t occur on my custom domain.
I can’t share my repo as it’s my client’s, but I’d be happy to help or share specific details on how we handled things.
@vdilly The redirects system is fairly limited in its capabilities, so for more complex use-cases you can use Edge Functions.
I’ve not tried this myself so it probably doesn’t work, but thinking on possible solutions with features I can see in the documentation for redirects, would it be possible for your proxy to pass an additional parameter that you could key off?