File: example_page_rules.sh

package info (click to toggle)
python-cloudflare 2.20.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,048 kB
  • sloc: python: 6,932; makefile: 138; sh: 76
file content (16 lines) | stat: -rwxr-xr-x 440 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
:

ZONE=${1-example.com}

URL_MATCH="*.${ZONE}/url1*"
URL_FORWARDED="http://${ZONE}/url2"

cli4 --post \
	targets='[ { "target": "url", "constraint": { "operator": "matches", "value": "'${URL_MATCH}'" } } ]' \
	actions='[ { "id": "forwarding_url", "value": { "status_code": 302, "url": "'${URL_FORWARDED}'" } } ]' \
	status=active \
	priority=1 \
		/zones/:${ZONE}/pagerules | jq '{"status":.status,"priority":.priority,"id":.id}'

exit 0