Cloudflare Redirect breaking CSS and JS

Hi, I have written a website in Astro that is hosted on Cloudflare Pages. I have written redirect rules related to cookie values and country the visitors is from. The redirect itself works great. But it breaks the site's CSS, JS and image links. Is there a way to make the redirects work and not break the site?
3 Replies
Erisa
Erisa7mo ago
Youd have to share the rule contents, most likely one or more of them is redirecting the assets mistakenly instead of just html pages
Chris | Warawul Coffee GmbH
Hi, so I used the redirect rules and it has the If Expression
(ip.geoip.country ne "DE" and not http.cookie contains "userLang=de" and not starts_with(http.request.uri.path, "/en"))
(ip.geoip.country ne "DE" and not http.cookie contains "userLang=de" and not starts_with(http.request.uri.path, "/en"))
and Then Expression Dynamic
concat("https://",http.host,"/en",http.request.uri.path)
concat("https://",http.host,"/en",http.request.uri.path)
and status code 302 And the other one has the If expression
(http.cookie contains "userLang=en" and not starts_with(http.request.uri.path, "/en"))
(http.cookie contains "userLang=en" and not starts_with(http.request.uri.path, "/en"))
Would be gratefule for your help! @Erisa | Support Engineer can you help? Can anyone else help?