From e67c89500db514e2b40bb82dac5f0d990d45f8e7 Mon Sep 17 00:00:00 2001 From: OnCloud Date: Sat, 23 Nov 2024 21:55:47 +0800 Subject: [PATCH] Update serve-from-custom-domains.mdx --- .../serve-from-custom-domains.mdx | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/content/docs/images/manage-images/serve-images/serve-from-custom-domains.mdx b/src/content/docs/images/manage-images/serve-images/serve-from-custom-domains.mdx index 43c18f3b7d9dbc..91fe087fc50a96 100644 --- a/src/content/docs/images/manage-images/serve-images/serve-from-custom-domains.mdx +++ b/src/content/docs/images/manage-images/serve-images/serve-from-custom-domains.mdx @@ -42,16 +42,18 @@ To create a rule: 2. Select **Rules** > **Transform Rules**. 3. Select **Create rule**. 4. Under **When incoming requests match...**, select **Edit expression**. -5. In the text field, enter `starts_with(http.request.uri.path, "/images")`. +5. In the text field, choose one of the following options: + - To allow requests from any hostname with the path `/images`, use: `starts_with(http.request.uri.path, "/images")`. + - To allow requests from a specific hostname like `images.example.com` with the path `/images`, use: `http.host eq "images.example.com" and starts_with(http.request.uri.path, "/images")`. 6. Under **Path**, select **Rewrite to**. -7. Select *Dynamic* and enter the following in the text field. - -```txt -concat( - "/cdn-cgi/imagedelivery/", - substring(http.request.uri.path, 7) -) -``` +7. Choose *Dynamic* and enter the following in the text field, replacing `` with the appropriate value from the Cloudflare Images Dashboard. Ensure that the second argument of the substring function corresponds to the length of the path you specified in step 5. + + ```txt + concat( + "/cdn-cgi/imagedelivery//", + substring(http.request.uri.path, 7) + ) + ``` 8. Select **Deploy** when you are done.