URL redirection with variable

Hi 😉 How can I redirect a URL with a variable? Here is an example: https://example.com/{username} https://api.secondexample.com/media/profilephoto/{username}/1024.jpg My problem is that the variable is in the middle of the URL, not at the end, which makes it difficult. I have no idea/knowledge how to do this using CloudFlare.
2 Replies
z0rrn
z0rrn•4mo ago
I'm not sure but maybe you can use something like this: https://developers.cloudflare.com/rules/url-forwarding/single-redirects/examples/#redirect-all-requests-to-a-different-hostname but set the then expression like this: concat("https://globalstore.example.net/media/profilephoto", http.request.uri.path, "1024.jpg") or this: concat("https://globalstore.example.net/media/profilephoto", http.request.uri.path, "/1024.jpg").
chelminski
chelminski•4mo ago
Thx. It's working 😄