Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions packages/config/src/rules/request/createMPA.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import type { AzionRuleCriteriaWithValue } from '../../types';
import { ALL_EXTENSIONS } from '../constants';
import { createMPARules } from './createMPA';

describe('createMPARules', () => {
Expand All @@ -26,7 +25,7 @@ describe('createMPARules', () => {
variable: '${uri}',
conditional: 'if',
operator: 'matches',
argument: `\\.(${ALL_EXTENSIONS.join('|')})$`,
argument: `\\.[a-zA-Z0-9-._]+`,
},
],
],
Expand Down
6 changes: 3 additions & 3 deletions packages/config/src/rules/request/createMPA.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import type { AzionRules } from 'azion/config';
import { ALL_EXTENSIONS } from '../constants';

/**
* Creates rules for a Multi Page Application (MPA) on Azion Platform.
Expand All @@ -23,7 +22,8 @@ export function createMPARules(
staticExtensions?: string[];
} = {},
): AzionRules {
const { connector = 'name-connector', application = 'name-application', staticExtensions = ALL_EXTENSIONS } = options;
const { connector = 'name-connector', application = 'name-application', staticExtensions } = options;
const staticAssetsArgument = staticExtensions ? `\\.(${staticExtensions.join('|')})$` : `\\.[a-zA-Z0-9-._]+`;

return {
request: [
Expand All @@ -37,7 +37,7 @@ export function createMPARules(
variable: '${uri}',
conditional: 'if',
operator: 'matches',
argument: `\\.(${staticExtensions.join('|')})$`,
argument: staticAssetsArgument,
},
],
],
Expand Down
3 changes: 1 addition & 2 deletions packages/config/src/rules/request/createSPA.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import type { AzionRuleCriteriaWithValue } from '../../types';
import { ALL_EXTENSIONS } from '../constants';
import { createSPARules } from './createSPA';

describe('createSPARules', () => {
Expand All @@ -26,7 +25,7 @@ describe('createSPARules', () => {
variable: '${uri}',
conditional: 'if',
operator: 'matches',
argument: `\\.(${ALL_EXTENSIONS.join('|')})$`,
argument: `\\.[a-zA-Z0-9-._]+`,
},
],
],
Expand Down
6 changes: 3 additions & 3 deletions packages/config/src/rules/request/createSPA.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import type { AzionRules } from 'azion/config';
import { ALL_EXTENSIONS } from '../constants';

/**
* Creates rules for a Single Page Application (SPA) on Azion Platform.
Expand All @@ -23,7 +22,8 @@ export function createSPARules(
staticExtensions?: string[];
} = {},
): AzionRules {
const { connector = 'name-connector', application = 'name-application', staticExtensions = ALL_EXTENSIONS } = options;
const { connector = 'name-connector', application = 'name-application', staticExtensions } = options;
const staticAssetsArgument = staticExtensions ? `\\.(${staticExtensions.join('|')})$` : `\\.[a-zA-Z0-9-._]+`;

return {
request: [
Expand All @@ -37,7 +37,7 @@ export function createSPARules(
variable: '${uri}',
conditional: 'if',
operator: 'matches',
argument: `\\.(${staticExtensions.join('|')})$`,
argument: staticAssetsArgument,
},
],
],
Expand Down