@tramvai/module-common 7.11.1 → 7.16.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.
@@ -15,11 +15,16 @@ RequestManagerModule = __decorate([
15
15
  multi: true,
16
16
  useFactory: ({ context, requestManager }) => {
17
17
  return function dehydrateRequestManager() {
18
+ // do not send IP into browser for SSG, CSR and ISR
19
+ const disableIpRehydration = requestManager.getHeader('x-tramvai-static-page-revalidate') ||
20
+ requestManager.getHeader('x-tramvai-prerender');
18
21
  return context.dispatch(setRequest({
19
22
  body: requestManager.getBody(),
20
- headers: {
21
- 'x-real-ip': requestManager.getClientIp(),
22
- },
23
+ headers: disableIpRehydration
24
+ ? {}
25
+ : {
26
+ 'x-real-ip': requestManager.getClientIp(),
27
+ },
23
28
  }));
24
29
  };
25
30
  },
@@ -19,11 +19,16 @@ exports.RequestManagerModule = tslib.__decorate([
19
19
  multi: true,
20
20
  useFactory: ({ context, requestManager }) => {
21
21
  return function dehydrateRequestManager() {
22
+ // do not send IP into browser for SSG, CSR and ISR
23
+ const disableIpRehydration = requestManager.getHeader('x-tramvai-static-page-revalidate') ||
24
+ requestManager.getHeader('x-tramvai-prerender');
22
25
  return context.dispatch(RequestManagerStore.setRequest({
23
26
  body: requestManager.getBody(),
24
- headers: {
25
- 'x-real-ip': requestManager.getClientIp(),
26
- },
27
+ headers: disableIpRehydration
28
+ ? {}
29
+ : {
30
+ 'x-real-ip': requestManager.getClientIp(),
31
+ },
27
32
  }));
28
33
  };
29
34
  },
@@ -50,7 +50,9 @@ class RequestManager {
50
50
  }
51
51
  getHost() {
52
52
  if (typeof window === 'undefined') {
53
- return (this.getHeader('x-original-host') || this.getHeader('host'));
53
+ return (this.getHeader('x-original-host') ||
54
+ this.getHeader('x-forwarded-host') ||
55
+ this.getHeader('host'));
54
56
  }
55
57
  return window.location.host;
56
58
  }
@@ -50,7 +50,9 @@ class RequestManager {
50
50
  }
51
51
  getHost() {
52
52
  if (typeof window === 'undefined') {
53
- return (this.getHeader('x-original-host') || this.getHeader('host'));
53
+ return (this.getHeader('x-original-host') ||
54
+ this.getHeader('x-forwarded-host') ||
55
+ this.getHeader('host'));
54
56
  }
55
57
  return window.location.host;
56
58
  }
@@ -54,7 +54,9 @@ class RequestManager {
54
54
  }
55
55
  getHost() {
56
56
  if (typeof window === 'undefined') {
57
- return (this.getHeader('x-original-host') || this.getHeader('host'));
57
+ return (this.getHeader('x-original-host') ||
58
+ this.getHeader('x-forwarded-host') ||
59
+ this.getHeader('host'));
58
60
  }
59
61
  return window.location.host;
60
62
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tramvai/module-common",
3
- "version": "7.11.1",
3
+ "version": "7.16.1",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
@@ -36,30 +36,30 @@
36
36
  "@tinkoff/lru-cache-nano": "^7.9.0",
37
37
  "@tinkoff/pubsub": "0.10.1",
38
38
  "@tinkoff/url": "0.13.1",
39
- "@tramvai/experiments": "7.11.1",
40
- "@tramvai/module-cookie": "7.11.1",
41
- "@tramvai/module-environment": "7.11.1",
42
- "@tramvai/module-log": "7.11.1",
39
+ "@tramvai/experiments": "7.16.1",
40
+ "@tramvai/module-cookie": "7.16.1",
41
+ "@tramvai/module-environment": "7.16.1",
42
+ "@tramvai/module-log": "7.16.1",
43
43
  "@tramvai/safe-strings": "0.10.1",
44
- "@tramvai/tokens-child-app": "7.11.1",
45
- "@tramvai/tokens-common": "7.11.1",
46
- "@tramvai/tokens-core-private": "7.11.1",
47
- "@tramvai/tokens-metrics": "7.11.1",
48
- "@tramvai/tokens-render": "7.11.1",
49
- "@tramvai/tokens-router": "7.11.1",
50
- "@tramvai/tokens-server-private": "7.11.1",
51
- "@tramvai/types-actions-state-context": "7.11.1",
44
+ "@tramvai/tokens-child-app": "7.16.1",
45
+ "@tramvai/tokens-common": "7.16.1",
46
+ "@tramvai/tokens-core-private": "7.16.1",
47
+ "@tramvai/tokens-metrics": "7.16.1",
48
+ "@tramvai/tokens-render": "7.16.1",
49
+ "@tramvai/tokens-router": "7.16.1",
50
+ "@tramvai/tokens-server-private": "7.16.1",
51
+ "@tramvai/types-actions-state-context": "7.16.1",
52
52
  "hoist-non-react-statics": "^3.3.1"
53
53
  },
54
54
  "peerDependencies": {
55
- "@tinkoff/dippy": "0.13.2",
55
+ "@tinkoff/dippy": "^1.0.0",
56
56
  "@tinkoff/utils": "^2.1.2",
57
- "@tramvai/cli": "7.11.1",
58
- "@tramvai/core": "7.11.1",
59
- "@tramvai/papi": "7.11.1",
60
- "@tramvai/react": "7.11.1",
61
- "@tramvai/state": "7.11.1",
62
- "@tramvai/tokens-server": "7.11.1",
57
+ "@tramvai/cli": "7.16.1",
58
+ "@tramvai/core": "7.16.1",
59
+ "@tramvai/papi": "7.16.1",
60
+ "@tramvai/react": "7.16.1",
61
+ "@tramvai/state": "7.16.1",
62
+ "@tramvai/tokens-server": "7.16.1",
63
63
  "react": ">=16.14.0",
64
64
  "tslib": "^2.4.0"
65
65
  },