Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update serve-from-custom-domains.mdx #18365

Open
wants to merge 1 commit into
base: production
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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/<ACCOUNT_HASH>",
substring(http.request.uri.path, 7)
)
```
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.

```txt
concat(
"/cdn-cgi/imagedelivery/<ACCOUNT_HASH>/",
substring(http.request.uri.path, 7)
)
```

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

Expand Down
Loading