diff --git a/src/content/docs/rules/cloud-connector/examples/route-images-to-s3.mdx b/src/content/docs/rules/cloud-connector/examples/route-images-to-s3.mdx index 37917baf8414be7..1f2ca405b486d46 100644 --- a/src/content/docs/rules/cloud-connector/examples/route-images-to-s3.mdx +++ b/src/content/docs/rules/cloud-connector/examples/route-images-to-s3.mdx @@ -16,10 +16,14 @@ To route requests to `/images` on your domain to an AWS S3 bucket: - **Subdomain-style URL**: Set the hostname to `.s3.amazonaws.com`. In this case, your files should be organized in the root of the bucket, meaning the URI path will map directly to the file. For example, `https:///images/file.jpg` will map to `https://.s3.amazonaws.com/images/file.jpg`. - **URI path-style URL**: Set the hostname to `s3.amazonaws.com`. Here, your bucket must include a folder named `images`, and files should be placed inside this folder. The URI path will then include the bucket name, like `https:////images/file.jpg` mapping to `https://s3.amazonaws.com//images/file.jpg`. 5. _(Optional)_ Use [URL Rewrite Rules](/rules/transform/url-rewrite/) to adjust the URL structure. For example, you can [create a URL rewrite](/rules/transform/url-rewrite/create-dashboard/) that changes `/images` to `//images` to match the URI path-style URL structure. -6. Select **Next** and enter a descriptive name like `Route images to S3` in **Cloud Connector name**. -7. Under **If**, select **Custom filter expression** and enter the following expression:
+6. _(Optional)_ Use [Cache Rules](/cache/how-to/cache-rules/) to adjust the caching behavior for objects returned from the bucket. For example, you can [create a cache rule](/cache/how-to/cache-rules/create-dashboard/) that caches every returned object matching the `/images/*` URI path for seven days: + - **If incoming requests match** > Custom filter expression: `(starts_with(http.request.uri.path, "/images/"))` + - **Cache eligibility**: Eligible for cache + - **Edge TTL** > Ignore cache-control header and use this TTL: _7 days_ +7. Select **Next** and enter a descriptive name like `Route images to S3` in **Cloud Connector name**. +8. Under **If**, select **Custom filter expression** and enter the following expression:
`http.request.full_uri wildcard "http*:///images/*"`
Replace `` with desired hostname. -8. Select **Deploy** to activate the rule. +9. Select **Deploy** to activate the rule. This setup will route all traffic matching `http*:///images/*` (HTTPS and HTTP requests) to your S3 bucket. Make sure to replace `` with your actual hostname and adjust the example paths according to your setup. diff --git a/src/content/docs/rules/cloud-connector/examples/send-eu-visitors-to-gcs.mdx b/src/content/docs/rules/cloud-connector/examples/send-eu-visitors-to-gcs.mdx index 30dc2eba8503e99..10dc34352d29eee 100644 --- a/src/content/docs/rules/cloud-connector/examples/send-eu-visitors-to-gcs.mdx +++ b/src/content/docs/rules/cloud-connector/examples/send-eu-visitors-to-gcs.mdx @@ -16,10 +16,11 @@ To route requests from visitors in the European Union to a Google Cloud Storage - **Subdomain-style URL**: For `.storage.googleapis.com`, your files should be organized in the root of the bucket. For example, `https:///index.html` will map to `https://.storage.googleapis.com/index.html`. - **URI path-style URL**: If you set the hostname to `storage.googleapis.com`, your bucket must include folders corresponding to the intended URI paths. For example, if you want `https:///eu/index.html` to map to a file in your bucket, the file should be placed at `https://storage.googleapis.com//eu/index.html`. 5. _(Optional)_ Use [URL Rewrite Rules](/rules/transform/url-rewrite/) to adjust the URL structure. For example, you can [create a URL rewrite](/rules/transform/url-rewrite/create-dashboard/) that changes `/eu` to `/` to match the URI path-style URL structure. -6. Select **Next** and enter a descriptive name like `Route EU visitors to GCP` in **Cloud Connector name**. -7. Under **If**, select **Custom filter expression** and enter the following expression: +6. _(Optional)_ Use [Cache Rules](/cache/how-to/cache-rules/) to adjust the caching behavior for objects returned from the bucket. For example, you can [create a cache rule](/cache/how-to/cache-rules/create-dashboard/) that caches every returned object matching the `/eu` URI path for seven days (defined through the **Edge TTL** setting). +7. Select **Next** and enter a descriptive name like `Route EU visitors to GCP` in **Cloud Connector name**. +8. Under **If**, select **Custom filter expression** and enter the following expression: `(ip.src.is_in_european_union)`
This expression targets traffic from European Union users. -8. Select **Deploy** to activate the rule. +9. Select **Deploy** to activate the rule. This configuration will route traffic from EU visitors to your Google Cloud Storage bucket. Make sure to replace `` with your actual hostname and adjust the example paths according to your setup. diff --git a/src/content/docs/rules/cloud-connector/examples/serve-static-assets-from-azure.mdx b/src/content/docs/rules/cloud-connector/examples/serve-static-assets-from-azure.mdx index 139768587347d16..3d22e8352743bd9 100644 --- a/src/content/docs/rules/cloud-connector/examples/serve-static-assets-from-azure.mdx +++ b/src/content/docs/rules/cloud-connector/examples/serve-static-assets-from-azure.mdx @@ -15,9 +15,10 @@ To serve static assets from an Azure Blob Storage container: 4. Enter the bucket URL. Use the following URL structure: - **Subdomain-style URL**: Set the hostname to `.blob.core.windows.net`. In this case, your bucket should include a folder named `static-assets`, and files should be placed inside this folder. For example, `https:///static-assets/style.css` will map to `https://.blob.core.windows.net/static-assets/style.css`. 5. _(Optional)_ Use [URL Rewrite Rules](/rules/transform/url-rewrite/) to adjust the URL structure. For example, you can [create a URL rewrite](/rules/transform/url-rewrite/create-dashboard/) that changes `/static-assets` to `/my-pages-project/static-assets` to match the file structure of your object storage bucket. -6. Click **Next** and enter a descriptive name like `Serve static assets from Azure` in **Cloud Connector name**. -7. Under **If**, select **Custom filter expression** and enter the following expression: +6. _(Optional)_ Use [Cache Rules](/cache/how-to/cache-rules/) to adjust the caching behavior for objects returned from the bucket. For example, you can [create a cache rule](/cache/how-to/cache-rules/create-dashboard/) that caches every returned object matching the `/static-assets` URI path for seven days (defined through the **Edge TTL** setting). +7. Click **Next** and enter a descriptive name like `Serve static assets from Azure` in **Cloud Connector name**. +8. Under **If**, select **Custom filter expression** and enter the following expression: `http.request.full_uri wildcard "http*:///static-assets/*"`
-8. Select **Deploy** to activate the rule. +9. Select **Deploy** to activate the rule. This setup ensures that all traffic matching `http*:///static-assets/*` (HTTPS and HTTP requests) is served from your Azure Blob Storage container. Make sure to replace `` with your actual hostname and adjust the example paths according to your setup. diff --git a/src/content/docs/rules/cloud-connector/index.mdx b/src/content/docs/rules/cloud-connector/index.mdx index f65e8fcb5cab4ca..61b4a5346002eb4 100644 --- a/src/content/docs/rules/cloud-connector/index.mdx +++ b/src/content/docs/rules/cloud-connector/index.mdx @@ -38,6 +38,16 @@ Cloud Connector will perform the following configurations automatically, dependi - Modify the `Host` header. - Adjust SSL/TLS for bucket-related traffic ([AWS S3 website endpoints](/rules/cloud-connector/providers/#ssl-connections-to-aws-s3-endpoints) only). +:::note[Additional configurations you may need] + +Cloud Connector will not apply any of the following configurations: + +- **Cache content served from storage bucket**: To define custom cache behavior — like when to cache returned objects and for [how long](/cache/how-to/cache-rules/settings/#edge-ttl) — you will need to create a [cache rule](/cache/how-to/cache-rules/). For an example rule configuration, refer to [Cache Level (Cache Everything)](/cache/how-to/cache-rules/examples/cache-everything/). + +- **Create URL rewrites**: To adjust the URL structure from what your website visitors use to obtain a resource and the folder structure being used in the storage bucket, you will need to create a [URL rewrite](/rules/transform/url-rewrite/). For example, you could create a URL rewrite to remove the `/files` prefix from URI paths before routing the request to your object storage bucket. For an example configuration, refer to [Rewrite path for object storage bucket](/rules/transform/examples/rewrite-path-object-storage/). + +::: + ## Availability Cloud Connector is available in beta to all customers. The maximum number of rules depends on your Cloudflare plan: