Search
Star
Feedback
Setup for Free
Β© 2026 Hedgehog Software, LLC
Twitter
GitHub
Discord
System
Light
Dark
More
Communities
Docs
About
Terms
Privacy
Transform Rule not replacing URL correctly - Cloudflare Developers
CD
Cloudflare Developers
β’
2y ago
β’
3 replies
killakonny
Transform Rule not replacing URL correctly
Hi all
!
I am trying to rewrite a called URL with transform rules
, but it does not work out as expected
.
What I got is
:
I call
https://mysampledomain.com/images/width=1000,quality=10/img/someimage.jpg
Now the transform rule should transform the called url to
:
https://mysampledomain.com/images/width=1000,quality=10/https://anotherdomain.com/media/image/someimage.jpg
but what the transformation gives me is
:
https://mysampledomain.com/images/width=1000,quality=10/https:/anotherdomain.com/media/image/someimage.jpg
As you can see in the injected url the second slash is missing
, and thats why I get an invalid url error
.
my matching string is
:
(http
.request
.uri
.path matches
"
/img
/
.
"
) and
(not
(any
(http
.request
.headers
[
"via
"
]
[
] contains
"image
-resizing
"
)
)
)
and the rewrite to dynamic string is
: regex
_replace
(http
.request
.uri
.path
,
"
(
.
)
/img
/
(
.
)
"
,
"
$
{1
}
/
https://anotherdomain.com/media/image/${2}
https://anotherdomain.com/media/image/${2}
"
)
Any ideas why the second slash is not transformed correctly
? Do I have to escape the slashes in some way
?
Thanks in advance
Cloudflare Developers
Join
Welcome to the official Cloudflare Developers server. Here you can ask for help and stay updated with the latest news
85,042
Members
View on Discord
Resources
ModelContextProtocol
ModelContextProtocol
MCP Server
Similar Threads
Was this page helpful?
Yes
No
Recent Announcements
Similar Threads
Transform Rule not transforming
CD
Cloudflare Developers / general-help
3y ago
Rule not working correctly
CD
Cloudflare Developers / general-help
2y ago
Replacing Dynmap Url
CD
Cloudflare Developers / general-help
2y ago
Transform via URL
CD
Cloudflare Developers / general-help
2y ago