question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Server side rendered locale switching links will always start with http

See original GitHub issue

Version

v5.2.1

Reproduction link

-

Steps to reproduce

What is expected ?

What is actually happening?

Additional comments?

In https://github.com/nuxt-community/nuxt-i18n/blob/e2aa687083873b6cb20b29beb044db8572e223cf/src/plugins/routing.js#L56 req.secure is used, which is only defined in Express, but SSR context only provides Node’s http.IncomingMessage which does not contain such property, resulting in any of the links generated by switchLocalePath server side to start with http.

<div align="right">This bug report is available on Nuxt community (#c128)</div>

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:9 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
pi0commented, Jun 17, 2019

Checking protocol can be easily done for this module:

https://github.com/nuxt-community/is-https

Which is already used by sitemap module

1reaction
rchlcommented, Jun 14, 2019

The logic is not that big (https://github.com/expressjs/express/blob/b8e50568af9c73ef1ade434e92c60d389868361d/lib/request.js#L306) but:

It feels kinda wrong to have to have all that in nuxt-i18n itself. It would be better if nuxt itself took care of those things. I wished nuxt used expressjs instead of connect…

Read more comments on GitHub >

github_iconTop Results From Across the Web

Server side rendered locale switching links will always start ...
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity...
Read more >
Localized Server-Side Rendering with React | Phrase
When handling a request, our Express server will often be given an Accept-Language HTTP header. This header contains a list of the locales...
Read more >
How does server side internationalization (i18n) look like? de
In this blog post we will shed light on the server side. Why do I need to handle i18n in my application's backend?...
Read more >
react-router Link doesn't render href attribute with server side ...
Inside Hello component i am using two react-router Links, but these two Links doesn't render the href attributes. I am using here react-router...
Read more >
Advanced Features: Internationalized Routing - Next.js
When a user visits the application root (generally / ), Next.js will try to automatically detect which locale the user prefers based on...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found