Custom domain name on a worker seems buggy

I’ve created a new worker with a custom domain: and it seems that the HTTPS redirection automagically deployed by Cloudflare does not work well. I can see the new DNS entry added by CF pointing to the linked worker:

The HTTP version seems to work fine:

curl -i
HTTP/1.1 200 OK
Date: Fri, 12 Jan 2024 19:47:40 GMT
Content-Type: text/plain;charset=UTF-8
Content-Length: 11
Connection: keep-alive
Report-To: {"endpoints":[{"url":"https:\/\/\/report\/v3?s=i3sUlHDejZ7CHPVOAO%2F2qE%2FJoriAapKLOOZzgtZkmxzutjGHQU53UHaPRs1mr5vNGnUOuR2Cz%2FjLPvXOzX6h2K1Yw%2FSQgOzmMrLib5Z%2FV%2BYLlTme00Lze25gWbKKi2GPhUg%3D"}],"group":"cf-nel","max_age":604800}
NEL: {"success_fraction":0,"report_to":"cf-nel","max_age":604800}
Server: cloudflare
CF-RAY: 8447e9a05d4641fd-MRS 

While the HTTPS version is redirecting to the HTTP one oO:

curl -i
HTTP/2 301
date: Fri, 12 Jan 2024 19:47:44 GMT
cache-control: max-age=3600
expires: Fri, 12 Jan 2024 20:47:44 GMT
report-to: {"endpoints":[{"url":"https:\/\/\/report\/v3?s=f7VYHsP2FEWvWUNq1aYEmy2dNNaYyjo%2F7FNWX%2Bi7hp77jK4gLf4J1k2c8LyzCpE1y%2FC9A4eS1WOQyAfiddzXQ53uceeynl25AzziPMFZYWVQyuGEBuUvG%2Bp8hmfu%2BhWYYm0%3D"}],"group":"cf-nel","max_age":604800}
nel: {"success_fraction":0,"report_to":"cf-nel","max_age":604800}
server: cloudflare
cf-ray: 8447e9ba5cac1227-MRS

Any idea about what’s going on there ?

In the end, I moved the worker code to AWS, it has been a real PITA to configure the lambda function with the API gateway and the certificate but it works at least.