Cloudflare Tunnels, DNS records, wordpress path showing IP address, not domain name

Hello community! I have an issue that I cannot find help with, so I’m reaching out here in hopes of solving the problem. Please be patient and follow along, I will do my best to explain.

I’m an American living in China. Im building a small lab here to run a wordpress site. Cloudflare tunnels is perfect for me because the great firewall of China makes running a website difficult. Even when you pay a service to host a website, its crazy slow to work on, almost impossible because any data coming into China goes through a ton of different firewalls. However, getting data out of China is quick. The data infrastructure here is superior in every way. All cables have been replaces with fiber optics, all phones run on g5.

The particular area that I live in is zoned for commercial use, including the internet. Its crazy, blazing fast here. It makes perfect sense for me to take advantage of cloudflare tunnels to build an Ecommerce website. I am trying to build a LAMP stack wordpress site using Ubuntu 22.04. I don’t want to use anything else other then Apache2 because its more stable, and I don’t need a reverse proxy to use it. I have been following the guide below because I have tried 15 others, and this is the best one.

How to Install WordPress on Ubuntu 22.04 LTS Server

^^ Search that and you will find it, exact title name ^^

I have ran this setup a dozen times to try and fix my problem. The problem is that my local system does not have SSL installed, and I need to keep it that way to minimize conflictions, dns looping, with cloudflare tunnels. I have setup an SSL on my local server here a few times and have all sorts of problems with it.

I also have major problems when I setup my Wordpress using my domain. If I setup wordpress config file using my domain name from cloudflare, it will not let me log into my wp-admin without using the tunnel. In other words, I cannot login locally. I am forced to design my website through the tunnel… That means, the tunnel is being sent outside of the country, and then lops back around to my lab here, and its crazy slow because the data is going out the country and then forced to go back through the big great crazy slow firewall of China. Follow me so far? I cannot even log in using my ip address. Its so frustrating.

To top it all off, woocommerce is just not possible to use under this setting. Its because in my local environment I’m not using https, but yet cloudflare tunnels is forcing me to log into my admin as if I has an SSL installed on my system. Woocommerce is tricked and confused, and lots of conflicts…

To solve this problem, I installed wordpress locally without using my domain name, or without using an SSL. So my local site is something like h##p://192.168.1.212/wp-admin/. (made up address)This works like a charm. This is how I set up using “wordpress.conf” You would normally input your domain information here, not your ip address. But because cloudflare tunnels takes care of all of this outside of my local lab, anyone trying to access my website still shows up as the SSL certified URL that’s pointed to my IP address from the Cloudflare DNS configuration.

So now I have the ability to bypass cloudflare tunnels and login locally at “h##p://192.168.1.212/wp-admin/", so that I can develop my website with blazing speed. Also anyone who visits my site, they must use the domain “bikesarebest( dot)com” (made up name). And it works like a charm. I seem to have solved my problem, but NO!

If you lookup my website, you can go the the main page and everything is great. However, if you go to any other path, any other page, instead of using my domain, it will only use my ip address. For instance. If I am accessing my website through the tunnel, it will show as “h##ps://bikesarebest(dot)com”. But as soon as I access a path page of lets say h##ps://bikesarebest.com/about me/ Then it will not redirect. Instead it will try and take me to h**p://192.168.1.212/about me. …

I have been able to locate one other post where the guy had the same exact issue. He claimed he was able to contact Cloudflare and they guided him on how to setup his DNS records, and what rules to create and that it fixed the problem. So for the past two days, I have been playing around with cloudflare DNS records and rules trying to solve my problem. It’s a redirect issue for sure.

Is there anyone out there that knows what rules I can use to fix this frustrating problem? I AM SO CLOSE!!! I been working on this for 2 weeks.

Please help me!

I am also running into this issue have you solved it?