Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Server side rendered locale switching links will always start with http #123

Closed
Ingramz opened this issue Aug 31, 2018 · 9 comments
Closed

Comments

@Ingramz
Copy link

Ingramz commented Aug 31, 2018

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.

This bug report is available on Nuxt community (#c128)
@ghost ghost added the cmty:bug-report label Aug 31, 2018
@manniL
Copy link
Contributor

manniL commented Sep 24, 2018

A PR would be more then welcome :)

@stale
Copy link

stale bot commented Jun 13, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Jun 13, 2019
@Ingramz
Copy link
Author

Ingramz commented Jun 13, 2019

It does not seem a very easy fix as the method that determines req.secure is quite complex. Porting all of that logic over to this plugin is not very intuitive. I would certainly contribute, if I knew what the suitable solution was.

@stale stale bot removed the wontfix label Jun 13, 2019
@manniL
Copy link
Contributor

manniL commented Jun 13, 2019

Would it be possible to check the requested URL through req? 🤔

@Ingramz
Copy link
Author

Ingramz commented Jun 14, 2019

Not if the hosted application is behind a reverse proxy.

@rchl
Copy link
Collaborator

rchl commented 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...

@Ingramz
Copy link
Author

Ingramz commented Jun 14, 2019

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.

That's what I am thinking as well.

@pi0
Copy link

pi0 commented 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

@Ingramz
Copy link
Author

Ingramz commented Jun 17, 2019

@pi0 thanks. This is exactly what is needed. Including it in this package should be a no-brainer too...

@paulgv paulgv closed this as completed in 8cb3eb6 Jun 20, 2019
paulgv added a commit that referenced this issue Jun 20, 2019
fix: better server side protocol detection (fixes #123)
farnabaz pushed a commit to farnabaz/i18n-module that referenced this issue Mar 25, 2021
* feat: redesign header

* feat: improve search input and modal

* feat: redesign aside category list item

* fix: dark mode aside category item color

* feat: redesign TOC

* feat: redesign landing page

* fix: TOC title and icon

* feat: copy button in code blocks; closes nuxt-modules#117

* fix: dark mode TOC colors

* feat: refactor logo component; add option for logo+text customization; closes nuxt-modules#110

* fix: redesign external resources

* feat: redesign mobile navbar

* feat: move mobile menu button to header

* chore: cleanup

* fix: coding session

* feat: update typography

* chore: fixes

* fix: left align hamburger icon

* fix: make body lock work on iOS

* fix: try mobile safari aside fix

* fix: missing Tailwind config

* fix: try native CSS solution for mobile Safari aside issue

* fix: try -webkit-fill-available for mobile Safari bug

* fix: ...

* chore: cleanup

* feat: use warm gray pallete for dark mode

* fix: add missing dependency

* chore: update default color

Co-authored-by: Sébastien Chopin <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants