alchemymvc 1.3.18 → 1.3.19
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/lib/class/conduit.js +11 -11
- package/package.json +1 -1
package/lib/class/conduit.js
CHANGED
|
@@ -550,11 +550,11 @@ Conduit.setMethod(async function parseRequest() {
|
|
|
550
550
|
});
|
|
551
551
|
|
|
552
552
|
/**
|
|
553
|
-
* Parse the
|
|
553
|
+
* Parse the complete request URL if it hasn't been done yet
|
|
554
554
|
*
|
|
555
555
|
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
556
556
|
* @since 1.3.18
|
|
557
|
-
* @version 1.3.
|
|
557
|
+
* @version 1.3.19
|
|
558
558
|
*/
|
|
559
559
|
Conduit.setMethod(function parseUrl() {
|
|
560
560
|
|
|
@@ -569,6 +569,8 @@ Conduit.setMethod(function parseUrl() {
|
|
|
569
569
|
protocol = 'https://';
|
|
570
570
|
} else if (this.headers['x-forwarded-proto']) {
|
|
571
571
|
protocol = this.headers['x-forwarded-proto'];
|
|
572
|
+
} else if (this.headers[':scheme']) {
|
|
573
|
+
protocol = this.headers[':scheme'];
|
|
572
574
|
} else if (this.protocol) {
|
|
573
575
|
protocol = this.protocol;
|
|
574
576
|
} else if (this.encrypted) {
|
|
@@ -583,21 +585,19 @@ Conduit.setMethod(function parseUrl() {
|
|
|
583
585
|
// Set the protocol
|
|
584
586
|
this.url.protocol = protocol;
|
|
585
587
|
|
|
588
|
+
// Get the host/domain/authority of the request
|
|
589
|
+
const host = this.headers[':authority'] || this.headers.host;
|
|
590
|
+
|
|
586
591
|
// Set the host
|
|
587
|
-
this.url.hostname =
|
|
592
|
+
this.url.hostname = host;
|
|
588
593
|
|
|
589
594
|
// If no URL was set, use the first requests URL (without the path)
|
|
590
|
-
if (!alchemy.settings.url &&
|
|
595
|
+
if (!alchemy.settings.url && host) {
|
|
591
596
|
alchemy.setUrl(this.url);
|
|
592
597
|
}
|
|
593
598
|
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
if (this.prefix) {
|
|
597
|
-
path = '/' + this.prefix + '/' + path;
|
|
598
|
-
}
|
|
599
|
-
|
|
600
|
-
this.url.path = path;
|
|
599
|
+
// Set the entire original path
|
|
600
|
+
this.url.path = this.original_path;
|
|
601
601
|
|
|
602
602
|
return true;
|
|
603
603
|
});
|