URL Rewrite for SelfHosted Docker WebApp Using Tunnels

Hi!

I have a Selfhosted App running in Docker along with a Cloudflare Tunnel Docker in the same internal network. And have exposed the webserver inside the Docker on the internet, and that works fine.

My issue is there are some AJAX requests in the webapp from the client back to the docker with the Wrong URL. Is there anyway to rewrite all the wrong URLs to the correct one, so that they reach the Docker?

Example:
My site “mydomain.com” now works, but any Ajax requests goes to http://172.17.0.1:5555 from the client web-browser. I need to rewrite “http://172.17.0.1:5555/myajaxfunction” → “https://mydomain.com/myajaxfunction

Anyhelp would be appreciated. I thought I could use “Transform Rules” - but I was not able to figure it out - or get it to work.