Skip to content

Commit e67c895

Browse files
Update serve-from-custom-domains.mdx
1 parent 1bd6c18 commit e67c895

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

src/content/docs/images/manage-images/serve-images/serve-from-custom-domains.mdx

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -42,16 +42,18 @@ To create a rule:
4242
2. Select **Rules** > **Transform Rules**.
4343
3. Select **Create rule**.
4444
4. Under **When incoming requests match...**, select **Edit expression**.
45-
5. In the text field, enter `starts_with(http.request.uri.path, "/images")`.
45+
5. In the text field, choose one of the following options:
46+
- To allow requests from any hostname with the path `/images`, use: `starts_with(http.request.uri.path, "/images")`.
47+
- 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")`.
4648
6. Under **Path**, select **Rewrite to**.
47-
7. Select *Dynamic* and enter the following in the text field.
48-
49-
```txt
50-
concat(
51-
"/cdn-cgi/imagedelivery/<ACCOUNT_HASH>",
52-
substring(http.request.uri.path, 7)
53-
)
54-
```
49+
7. Choose *Dynamic* and enter the following in the text field, replacing `<ACCOUNT_HASH>` 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.
50+
51+
```txt
52+
concat(
53+
"/cdn-cgi/imagedelivery/<ACCOUNT_HASH>/",
54+
substring(http.request.uri.path, 7)
55+
)
56+
```
5557

5658
8. Select **Deploy** when you are done.
5759

0 commit comments

Comments
 (0)