edge-functions 3.2.0 → 3.2.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/CHANGELOG.md CHANGED
@@ -1,3 +1,17 @@
1
+ ### [3.2.1](https://github.com/aziontech/vulcan/compare/v3.2.0...v3.2.1) (2024-08-20)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * update origin path handling to disallow / ([#375](https://github.com/aziontech/vulcan/issues/375)) ([ba22331](https://github.com/aziontech/vulcan/commit/ba22331857f141fb6f3d7b8d9f75090b1a94bcbd))
7
+
8
+ ### [3.2.1-stage.1](https://github.com/aziontech/vulcan/compare/v3.2.0...v3.2.1-stage.1) (2024-08-20)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * update origin path handling to disallow / ([#375](https://github.com/aziontech/vulcan/issues/375)) ([ba22331](https://github.com/aziontech/vulcan/commit/ba22331857f141fb6f3d7b8d9f75090b1a94bcbd))
14
+
1
15
  ## [3.2.0](https://github.com/aziontech/vulcan/compare/v3.1.0...v3.2.0) (2024-08-16)
2
16
 
3
17
 
@@ -545,7 +545,7 @@ describe('Utils - generateManifest', () => {
545
545
  {
546
546
  name: 'my single origin',
547
547
  type: 'single_origin',
548
- path: '/',
548
+ path: '',
549
549
  addresses: [
550
550
  {
551
551
  address: 'http.bin.org',
@@ -576,7 +576,7 @@ describe('Utils - generateManifest', () => {
576
576
  address: 'http.bin.org',
577
577
  },
578
578
  ],
579
- origin_path: '/',
579
+ origin_path: '',
580
580
  method: 'ip_hash',
581
581
  origin_protocol_policy: 'preserve',
582
582
  host_header: '${host}',
@@ -928,6 +928,22 @@ describe('Utils - generateManifest', () => {
928
928
  ]),
929
929
  );
930
930
  });
931
+
932
+ it('should throw an error when the origin path is "/"', () => {
933
+ const azionConfig = {
934
+ origin: [
935
+ {
936
+ name: 'my single',
937
+ type: 'single_origin',
938
+ addresses: ['http.bin.org', 'http2.bin.org'],
939
+ path: '/',
940
+ },
941
+ ],
942
+ };
943
+ expect(() => jsToJson(azionConfig)).toThrow(
944
+ 'Origin path cannot be "/". Please use empty string or "/path"',
945
+ );
946
+ });
931
947
  });
932
948
 
933
949
  describe('jsToJson - Rules', () => {
@@ -18,7 +18,7 @@ export default {
18
18
  key: 'myorigin', // Optional. Key of your origin. Obtain this value via GET request. Cannot be changed via API.
19
19
  name: 'myneworigin', // Required
20
20
  type: 'single_origin', // Required. single_origin, load_balancer, object_storage, live_ingest. Defaults to single_origin if not provided
21
- path: '/', // Optional. Default '/' if not provided
21
+ path: '', // Optional. Default '' if not provided
22
22
  addresses: [
23
23
  // Required for single_origin, load_balancer, live_ingest. Optional for object_storage
24
24
  // or addresses: ['http.bin.org']
@@ -39,7 +39,12 @@ class OriginManifestStrategy extends ManifestStrategy {
39
39
  };
40
40
 
41
41
  if (origin.type !== 'object_storage') {
42
- originSetting.origin_path = origin.originPath || '/';
42
+ if (origin.path === '/') {
43
+ throw new Error(
44
+ 'Origin path cannot be "/". Please use empty string or "/path"',
45
+ );
46
+ }
47
+ originSetting.origin_path = origin.path || '';
43
48
  originSetting.origin_protocol_policy =
44
49
  origin.protocolPolicy || 'preserve';
45
50
  originSetting.method = origin.method || 'ip_hash';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "edge-functions",
3
3
  "type": "module",
4
- "version": "3.2.0",
4
+ "version": "3.2.1",
5
5
  "description": "Tool to launch and build JavaScript/Frameworks. This tool automates polyfills for Edge Computing and assists in creating Workers, notably for the Azion platform.",
6
6
  "main": "lib/main.js",
7
7
  "bin": {