koa 2.6.0 → 2.6.1
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/History.md +6 -0
- package/lib/request.js +4 -2
- package/package.json +1 -1
package/History.md
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
|
|
2
|
+
2.6.1 / 2018-10-23
|
|
3
|
+
==================
|
|
4
|
+
|
|
5
|
+
**fixes**
|
|
6
|
+
* [[`4964242`](http://github.com/koajs/koa/commit/49642428342e5f291eb9d690802e83ed830623b5)] - fix: use X-Forwarded-Host first on app.proxy present (#1263) (fengmk2 <<fengmk2@gmail.com>>)
|
|
7
|
+
|
|
2
8
|
2.6.0 / 2018-10-23
|
|
3
9
|
==================
|
|
4
10
|
|
package/lib/request.js
CHANGED
|
@@ -252,8 +252,10 @@ module.exports = {
|
|
|
252
252
|
get host() {
|
|
253
253
|
const proxy = this.app.proxy;
|
|
254
254
|
let host = proxy && this.get('X-Forwarded-Host');
|
|
255
|
-
if (
|
|
256
|
-
|
|
255
|
+
if (!host) {
|
|
256
|
+
if (this.req.httpVersionMajor >= 2) host = this.get(':authority');
|
|
257
|
+
if (!host) host = this.get('Host');
|
|
258
|
+
}
|
|
257
259
|
if (!host) return '';
|
|
258
260
|
return host.split(/\s*,\s*/)[0];
|
|
259
261
|
},
|