@@ -32,6 +32,43 @@ const createNewVersion = async (propertyId: string) => {
3232 return getLatestVersion ( propertyId )
3333}
3434
35+ const patchDefaultRuleOrigin = async ( propertyId : string , version : string ) =>
36+ akamaiRequest ( {
37+ path : `/papi/v1/properties/${ propertyId } /versions/${ version } /rules?contractId=${ process . env . AK_CONTRACT_ID } &groupId=${ process . env . AK_GROUP_ID } ` ,
38+ method : 'PATCH' ,
39+ headers : {
40+ 'Content-Type' : 'application/json-patch+json' ,
41+ } ,
42+ body : JSON . stringify ( [
43+ {
44+ op : 'replace' ,
45+ path : '/rules/children/0/behaviors/0/options/customValidCnValues' ,
46+ value : [
47+ "{{Forward Host Header}}" ,
48+ "{{Origin Hostname}}"
49+ ]
50+ } ,
51+ {
52+ op : 'replace' ,
53+ path : '/rules/children/0/behaviors/0/options/verificationMode' ,
54+ value : "CUSTOM"
55+ } ,
56+ {
57+ op : 'replace' ,
58+ path : '/rules/children/0/behaviors/0/options/originCertsToHonor' ,
59+ value : "STANDARD_CERTIFICATE_AUTHORITIES"
60+ } ,
61+ {
62+ op : 'replace' ,
63+ path : '/rules/children/0/behaviors/0/options/standardCertificateAuthorities' ,
64+ value : [
65+ "THIRD_PARTY_AMAZON" ,
66+ "akamai-permissive"
67+ ]
68+ }
69+ ] )
70+ } )
71+
3572const patchOriginHostname = async ( propertyId : string , version : string ) =>
3673 akamaiRequest ( {
3774 path : `/papi/v1/properties/${ propertyId } /versions/${ version } /rules?contractId=${ process . env . AK_CONTRACT_ID } &groupId=${ process . env . AK_GROUP_ID } ` ,
@@ -130,6 +167,7 @@ import('../dist/patch-body/body.json').then((module) => {
130167 } catch ( _ ) {
131168 // Ignore error if fingerprint rules not exists
132169 }
170+ await patchDefaultRuleOrigin ( propertyId , propertyVersion )
133171 await patchAddFingerprintRules ( propertyId , propertyVersion , JSON . stringify ( patchReqBody ) )
134172 await activateVersion ( propertyId , propertyVersion )
135173 } catch ( e : any ) {
0 commit comments