Skip to content

Commit

Permalink
fix(cli): Update bunny.net (CI) edge rules for SWR ("SSR") on Cloudfl…
Browse files Browse the repository at this point in the history
…are instead of direct "ISR"

Also supporting custom origin URL on setup script instead of always using `<project>.web.app` (proxied to CF worker)

Having many problems to purge perma-cache for ISR implementation
  • Loading branch information
leomp12 committed Aug 24, 2024
1 parent 539d7b5 commit 20f02f8
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 56 deletions.
89 changes: 35 additions & 54 deletions packages/cli/ci/bunny-config-base.sh
Original file line number Diff line number Diff line change
Expand Up @@ -169,68 +169,70 @@ configure_edge_rule '
]
}
],
"Description": "Bypass CDN cache",
"Description": "Privates bypass CDN cache",
"Enabled": true
}
'

configure_edge_rule '
{
"ActionType": 3,
"ActionType": 15,
"TriggerMatchingType": 1,
"ActionParameter1": "600",
"Triggers": [
{
"Type": 0,
"PatternMatchingType": 0,
"PatternMatches": [
"*.xml",
"*.txt",
"*/app/*",
"*/~*",
"*/.*"
]
"*/_astro/*"
],
"PatternMatchingType": 2,
"Parameter1": ""
},
{
"Type": 8,
"PatternMatchingType": 0,
"Type": 3,
"PatternMatches": [
"200",
"404"
]
"webp",
"png",
"jpg",
"woff2",
"mp4"
],
"PatternMatchingType": 2,
"Parameter1": ""
}
],
"Description": "Reset feeds/app CDN cache",
"Description": "SSR bypass perma-cache",
"Enabled": true
}
'

configure_edge_rule '
{
"ActionType": 15,
"TriggerMatchingType": 0,
"ActionType": 3,
"ActionParameter1": "300",
"TriggerMatchingType": 1,
"Triggers": [
{
"Type": 0,
"PatternMatchingType": 0,
"PatternMatches": [
"*/_api/*",
"*/app/*",
"*/admin/*",
"*/~*",
"*/.*"
]
"*/_astro/*"
],
"PatternMatchingType": 2,
"Parameter1": ""
},
{
"Type": 0,
"PatternMatchingType": 0,
"Type": 3,
"PatternMatches": [
"*.xml",
"*.txt"
]
"webp",
"png",
"jpg",
"woff2",
"mp4"
],
"PatternMatchingType": 2,
"Parameter1": ""
}
],
"Description": "Bypass perma-cache",
"Description": "Reset SSR CDN cache",
"Enabled": true
}
'
Expand All @@ -240,6 +242,7 @@ configure_edge_rule '
"ActionType": 16,
"ActionParameter1": "120",
"ActionParameter2": null,
"TriggerMatchingType": 1,
"Triggers": [
{
"Type": 0,
Expand All @@ -262,8 +265,7 @@ configure_edge_rule '
"Parameter1": ""
}
],
"TriggerMatchingType": 1,
"Description": "SSR browser cache",
"Description": "Reset SSR browser cache",
"Enabled": true
}
'
Expand Down Expand Up @@ -333,24 +335,3 @@ configure_edge_rule '
"Enabled": true
}
'

configure_edge_rule '
{
"ActionType": 5,
"ActionParameter1": "Content-Type",
"ActionParameter2": "text/html",
"Triggers": [
{
"Type": 2,
"PatternMatchingType": 0,
"PatternMatches": [
"application/octet-stream"
],
"Parameter1": "Content-Type"
}
],
"TriggerMatchingType": 1,
"Description": "Force mime text/html",
"Enabled": true
}
'
3 changes: 1 addition & 2 deletions packages/cli/ci/bunny-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ fi

project_id=$1
domain=$2
origin_url="${3:-https://$project_id.web.app}"

storage_list=$(curl --silent --request GET \
--url https://api.bunny.net/storagezone \
Expand Down Expand Up @@ -51,8 +52,6 @@ if [ -z "$storage_id" ]; then
exit 1
fi

origin_url="https://$project_id.web.app"

get_pull_zone_id() {
pull_zone_list=$(curl --silent --request GET \
--url https://api.bunny.net/pullzone \
Expand Down

0 comments on commit 20f02f8

Please sign in to comment.