Proxmox + WordPress + Cloudflare Tunnel | ERR_TOO_MANY_REDIRECTS

The reason why I use Cloudflare Tunnel:

I am running my WordPress site with Proxmox VM. My network is behind CGNAT, so I cannot port-forward my WordPress site on my router. I cannot add an A record with it.

With the help of Cloudflare Tunnel, I can expose my servers running on the local network and behind CGNAT on the internet.

My problem is that it’s getting an error “ERR_TOO_MANY_REDIRECTS.”

Details:

  1. Configuration of my /etc/apache2/sites-available/wordpress.conf
<VirtualHost *:80>
    ServerName 192.168.254.102
    DocumentRoot /srv/www/wordpress
    <Directory /srv/www/wordpress>
        Options FollowSymLinks
        AllowOverride Limit Options FileInfo
        DirectoryIndex index.php
        Require all granted
    </Directory>
    <Directory /srv/www/wordpress/wp-content>
        Options FollowSymLinks
        Require all granted
    </Directory>
</VirtualHost>
  1. WordPress General Settings
WordPress Address (URL): http://192.168.254.102
Site Address (URL): https://mydomain.store
  1. Configuration of my /home/lance/.cloudflared/config.yml
url: http://localhost:80
tunnel: ********-****-****-****-********61fa
credentials-file: /home/lance/.cloudflared/********-****-****-****-********61fa.json

When I change Site Address (URL) from http://192.168.254.102 to https://mydomain.store, it gets an error ERR_TOO_MANY_REDIRECTS.

This only occurs on WordPress. My Nextcloud server went well.

How will I fix the issue? Thank you.

As you are only using port 80 in your Apache, what if you change the protocol to http://?

1 Like

Thanks, @erictung. It worked, but it broke the CSS styling of WordPress, and the page loading is so slow.

Test 1: I made some changes earlier. I changed the ServerName from 192.168.254.102 to mydomain.store.

Result: Sadly, it didn’t solve the issue.


Test 2: I reverted the Site Address (URL) from http://mydomain.store to http://192.168.254.102.

Result: When the domain is visited, it redirects the website visitors to http://192.168.254.102.


Test 3: I changed WordPress Address (URL) from http://192.168.254.102 to https://mydomain.store.

WordPress Address (URL): https://mydomain.store/
Site Address (URL): https://mydomain.store/

Result: It worked. It redirects to https://mydomain.store, but I could not access my WordPress Admin Dashboard. It gets an error ERR_TOO_MANY_REDIRECTS.


Can you recommend me some additional solution? Thank you.

P.S. I am a newbie in Linux Administration. :frowning:

I tried to recall what I did previously while setting up a new WordPress site with Cloudflare Tunnel.

If I remember correctly, if you are going to serve your WordPress site via HTTPS (enabled in Cloudflare) with the use of Cloudflare Tunnel, your Apache configuration should enable a new VirtualHost that listens via port 443 (with SSL certificate of course, it can be any SSL certificate including self-signed certificate). Then, your cloudflared config.yml (particularly the url key) should point to https://localhost and add a new setting called no-tls-verify: true.

Hi @erictung, it worked for me. I generated a self-signed certificate using this guide on DigitalOcean.

Thank you so much!

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.