Add support for subdomain routing
See original GitHub issueAs i18next-browser-languageDetector supports subdomain detection out of the box, it’d be nice to also support it here.
We would have two mutually exclusive options regarding routing:
localeSubpaths
(already exists)localeSubdomains
(does not exist)
Or perhaps we’d have a single localeRouting
option that would take an enum of strings, eg subpaths
or subdomains
.
We’d need to add logic to lng-path-corrector and lng-path-detector to handle subdomains instead of subpaths.
We’d also need to update the Link component.
I don’t yet know how feasible this proposal is, as it’s not possible to have a SPA across subdomains anyways. Development and testing will also be a pain.
Issue Analytics
- State:
- Created 5 years ago
- Comments:13 (11 by maintainers)
Top Results From Across the Web
Routing traffic for subdomains - Amazon Route 53
One way to route traffic for a subdomain is to create a hosted zone for the subdomain, and then create records for the...
Read more >Add support for subdomain routing #16 - i18next/next- ...
We'd need to add logic to lng-path-corrector and lng-path-detector to handle subdomains instead of subpaths. We'd also need to update the Link component....
Read more >Building a Rails App With Multiple Subdomains
We'll use Rails' powerful routing constructs to support multiple subdomains in our application. We'll also set up subdomains locally and ...
Read more >Creating a subdomain that uses Amazon Route 53 as ...
Using the method provided by the DNS service of the parent domain, add NS records for the subdomain to the zone file for...
Read more >How to Create a Subdomain for my Domain
1. Go to your Domain List and click Manage next to the domain: · 2. Select the Advanced DNS tab: · 3. Find...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hey @HeadFox, here is my implementation of my detector
languageByDomainDetector.js
The
getLanguageFromHostname
is a helper that I have a map of my domains which is mapped to a certain languageAnd when creating the next-i18next instance you pass like this:
When changing languages in the
localeSubpaths
approach, for example, we can maintain full SPA navigation. That is to say, a router event happens within NextJs and a new chunk/page and namespaces will be loaded, but are no new document requests or hard navigation.That is not possible over subdomains - you are forced to basically serve two completely different webpages. You might as well have static React apps, or just forcefully set the locale and don’t allow changing.