Cloudflare incorrectly redirect incomming requests

For Workers & Pages, what is the name of the domain?

https://borrow.place/

What is the issue or error you’re encountering

Cloudflare incorrectly redirect incomming requests (in this case wrong URL format is used, lead to inccorect path to GCP bucket)

What steps have you taken to resolve the issue?

We have taken the following steps to resolve the issue:

Validation of GCS bucket accessibility:
We confirmed that the images are correctly stored in the Google Cloud Storage bucket and can be accessed via their bucket URLs without any issues.

Review of Cloudflare logs:
We analyzed the Cloudflare logs to trace how requests are being processed and redirected. However, the logs did not clarify the final GCP URL or path Cloudflare attempts to access.

Testing URL redirection:
We conducted multiple tests to observe how Cloudflare rewrites the URLs and why it redirects to incorrect paths for the images.

Review of Cloudflare configurations:
We examined our settings in Cloudflare, including DNS configurations, page rules, and forwarding rules, to ensure no misconfigurations were present.

Adjustments to rules in Cloudflare:
We experimented with bypassing caching rules and modifying URL rewrite rules to attempt to fix the issue. Unfortunately, these changes did not resolve the problem.

Research and documentation:
We reviewed Cloudflare's documentation and community forums for guidance on resolving compatibility issues between Cloudflare and GCS buckets. Despite our efforts, we were unable to find a solution.

Despite these steps, we are still blocked and would greatly appreciate your assistance in identifying the correct rules or configurations to allow Cloudflare to forward requests to the appropriate GCS bucket paths. If further information or access is required, we are happy to provide it.

What are the steps to reproduce the issue?

Dear Cloudflare Team & Cloudflare Community,

At Borrow Place, we use Google Cloud Storage (GCS) buckets to store images and Cloudflare as the Content Delivery Network (CDN) for our application.
However, we are encountering a critical issue where all requests received by Cloudflare are redirected to an incorrect path (bucket URL), resulting in the error: “The specified bucket does not exist.”

For example:
The original image is stored at the following GCS bucket URL, which works correctly:

However, when accessed via Cloudflare, the URL is incorrectly rewritten to:
https://cdn.borrow.place/o/borrow-place-proffer-a105d8ba-0d4e-4053-aaf8-35b68397ccf1.jpg?generation=1730811392370985&alt=media
This redirection leads to the error, as the rewritten path is invalid. The primary challenge is that we are unable to determine where Cloudflare redirects requests on the GCP side. The logs do not provide clarity regarding the final URL Cloudflare attempts to access, leaving us unable to diagnose the issue or configure the necessary rules. Despite significant effort over the past few days, we remain blocked without a clear resolution.

Could you please review this issue and provide guidance on:
The specific rules or configurations required in Cloudflare to ensure requests are forwarded to the correct GCS bucket.
Any additional diagnostic steps or logging configurations that could help us identify the root cause of the incorrect redirection.

Your assistance in resolving this issue is greatly appreciated. Please let us know if you need further details or access to our current setup to assist with troubleshooting.
Thank you in advance for your support.

Best regards, Oleksandr

Can you post the original image link using the </> button (between backticks) as the forum software is saving the link to itself.

1 Like

Sure, here is one example: https://borrow-place-storage-v2.storage.googleapis.com/borrow-place-proffer-a105d8ba-0d4e-4053-aaf8-35b68397ccf1.jpg?generation=1730811392370985&alt=media

You say it’s rewriting to https://cdn.borrow.place/o/borrow-place-proffer-a105d8ba-0d4e-4053-aaf8-35b68397ccf1.jpg?generation=1730811392370985&alt=media, I meant what is the URL that Cloudflare is rewriting from?

When executing the request to fetch the image (e.g., this URL: https://cdn.borrow.place/o/borrow-place-proffer-a105d8ba-0d4e-4053-aaf8-35b68397ccf1.jpg?generation=1730811392370985&alt=media), I expect Cloudflare to serve it based on the configured caching rules. If the image is not available in the cache, Cloudflare should fetch it directly from the origin source:
https://borrow-place-storage-v2.storage.googleapis.com/borrow-place-proffer-a105d8ba-0d4e-4053-aaf8-35b68397ccf1.jpg?generation=1730811392370985&alt=media.

However, Cloudflare appears to make the request to an incorrect path, resulting in the image not being returned.

Could you confirm if this aligns with what you’re asking? I want to ensure I fully understand your question.

Cah you please help with this request?

Are you using the Cloudflare Cloud Connector for this? I’ve not used it yet (and only use R2 anyway).

If you think the request is being modified, you can use the trace tool to check what is happening as the request passes through the Cloudflare pipeline…
https://dash.cloudflare.com/?to=/:account/trace

1 Like