authscape 1.0.726 → 1.0.728
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +2 -1
- package/package.json +1 -1
- package/src/services/sitemapService.js +8 -1
package/index.js
CHANGED
|
@@ -9514,7 +9514,8 @@ function _generateSitemap() {
|
|
|
9514
9514
|
case 0:
|
|
9515
9515
|
_context2.prev = 0;
|
|
9516
9516
|
// Get the domain from the request
|
|
9517
|
-
|
|
9517
|
+
// Check multiple headers to determine the protocol
|
|
9518
|
+
protocol = req.headers['x-forwarded-proto'] || req.headers['x-forwarded-protocol'] || (req.connection && req.connection.encrypted ? 'https' : null) || (req.headers.referer && req.headers.referer.startsWith('https') ? 'https' : null) || 'https'; // Default to https as most production sites use SSL
|
|
9518
9519
|
host = req.headers.host;
|
|
9519
9520
|
domain = "".concat(protocol, "://").concat(host); // URL encode the domain for the API request
|
|
9520
9521
|
encodedDomain = encodeURIComponent(domain); // Make a basic HTTP GET request to AuthScape API
|
package/package.json
CHANGED
|
@@ -13,7 +13,14 @@
|
|
|
13
13
|
export async function generateSitemap(req, res, apiUri) {
|
|
14
14
|
try {
|
|
15
15
|
// Get the domain from the request
|
|
16
|
-
|
|
16
|
+
// Check multiple headers to determine the protocol
|
|
17
|
+
const protocol =
|
|
18
|
+
req.headers['x-forwarded-proto'] ||
|
|
19
|
+
req.headers['x-forwarded-protocol'] ||
|
|
20
|
+
(req.connection && req.connection.encrypted ? 'https' : null) ||
|
|
21
|
+
(req.headers.referer && req.headers.referer.startsWith('https') ? 'https' : null) ||
|
|
22
|
+
'https'; // Default to https as most production sites use SSL
|
|
23
|
+
|
|
17
24
|
const host = req.headers.host;
|
|
18
25
|
const domain = `${protocol}://${host}`;
|
|
19
26
|
|