-
-
-
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.
A PR would be more then welcome :)
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.
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.
Would it be possible to check the requested URL through req? :thinking:
Not if the hosted application is behind a reverse proxy.
The logic is not that big (https://github.com/expressjs/express/blob/b8e50568af9c73ef1ade434e92c60d389868361d/lib/request.js#L306) but:
proxy-addr dependencytrust proxy in expressjs provides here https://expressjs.com/en/4x/api.html#trust.proxy.options.table)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...
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.
Checking protocol can be easily done for this module:
https://github.com/nuxt-community/is-https
Which is already used by sitemap module
@pi0 thanks. This is exactly what is needed. Including it in this package should be a no-brainer too...
Most helpful comment
Checking protocol can be easily done for this module:
https://github.com/nuxt-community/is-https
Which is already used by sitemap module