Secure the localhost with the cloudfare tunnel on a docker instance

Hello to all,

I come to see you because I have almost the same problem as in this post Wordpress site with Cloudflare Tunnel, but I did not manage to solve the problem.

I have a cloudfare tunnel in which I put a docker container under wordpress, everything is fine except that I have images that are disappeared because I think the mixture of http and not https. (my domain is connected to cloudfare so the domain is secure, but it points to my localhost which is not)

In my file wp.config.php I added this by adapting it obviously to my conf: define(‘WP_HOME’,‘https://blog.mydomain.com/blog/’);
define(‘WP_SITEURL’, ‘https://blog.mydomain.com/blog/’);
I can’t add the two links in https because the localhost is not secured. And this is my problem.

I can’t find how to secure my localhost ! I tried using certbot but I think the bastard configuration between the cloudfare tunnel and the localhost prevents certbot from working properly.

Translated with DeepL Translate: The world's most accurate translator (free version)