Skip to content

Commit

Permalink
Make pagerule example more readable
Browse files Browse the repository at this point in the history
  • Loading branch information
mahtin committed May 17, 2016
1 parent ee50578 commit a23a777
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions examples/example-page-rules.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
:

cli4 -v --post \
targets='[ { "target": "url", "constraint": { "operator": "matches", "value": "*.example.com/url1*" } } ]' \
actions='[ { "id": "forwarding_url", "value": { "status_code": 302, "url": "http://example.com/url2" } } ]' \
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/:exmaple.com/pagerules | jq '{"status":.status,"priority":.priority,"id":.id}'
/zones/:${ZONE}/pagerules | jq '{"status":.status,"priority":.priority,"id":.id}'

exit 0

0 comments on commit a23a777

Please sign in to comment.