HTTPS with req.headers.host icw proxy

Timkor
6
Timkor
commented 4 months ago

What problem does this feature solve?

I would like to generate https links while nuxt runs without ssl. The proxy handles this.

What does the proposed changes look like?

A new config property which can force the generated links to use https.

https://github.com/nuxt-community/sitemap-module/blob/5d029a29443862bc6f8b5c141b3b01f9312f909c/lib/module.js#L152

idea
0
Timkor
6
Timkor
commented 4 months ago

I solved it by using the x-forwarded-proto header in the load balancer.

This is tested by the is-https package:
https://www.npmjs.com/package/is-https

Are there plans to keep supporting this in the future?

0
NicoPennec
1.4k
NicoPennec
commented 4 months ago

From my point of view, using x-forwarded-proto is enough, so it doesn't seem necessary to force https.

@Timkor why not just set the "hostname" parameter?

sitemap: {
    hostname: 'https://example.com',
    // ...
}
0
Timkor
6
Timkor
commented 4 months ago

@NicoPennec
Ok, then I will keep it that way.

I have multiple domains connected to my nuxt app. Like:

example.com
example.de
example.fr
example.it
example.es
0
NicoPennec
1.4k
NicoPennec
commented 4 months ago

@Timkor I closed the initial topic. But you have an interesting use case and so I need more details for a future feature ๐Ÿ˜‰

Do you need multiple sitemaps or always the same sitemap for each domain name (except for a dynamic hostname) ?

0
Informations
Feature Request โ€ข Open
#c46 - Created 4 months ago