Cloudflare Tunneling
-
2. Configuring wordpress
Tunnel Safe Dynamic WordPress URLs Setup.
Edit the wp-config.php Config File and Set:// ------------------------- // Tunnel-safe dynamic WP URLs // Using HTTP because the tunnel may not terminate SSL locally // This avoids WP redirecting everything to HTTPS unnecessarily // ------------------------- if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https') { $_SERVER['HTTPS'] = 'on'; } if (isset($_SERVER['HTTP_HOST'])) { $current_host = 'http://' . $_SERVER['HTTP_HOST']; define('WP_HOME', $current_host); define('WP_SITEURL', $current_host); }With this Configuration you’ll be able to access at the same time the website on Local and on Mobile through the Tunnel!
-
3. Accessing Localhost Online
Next you can Run the Cloudflare Tunnel to the Local Website with Online URL
By the Command:cloudflared tunnel --url http://localhost:80
To replace localhost to a custom Domain Name you have to set the default Apache URL to that one by changing the VHost config name prepending “000-“.
To Check what’s the current Default:sudo /usr/sbin/httpd -S
In case of Issue, Flushing Permalinks may be needed:
Wp-Admin > Setting > Permalinks
Change temporarily the Setup > Save > And Reset again.Last, Cloudflare will display you the Url where your app is available online like:
2025-11-10T11:28:31Z INF +--------------------------------------------------------------------------------------------+
2025-11-10T11:28:31Z INF | Your quick Tunnel has been created! Visit it at (it may take some time to be reachable): |
2025-11-10T11:28:31Z INF | https://cas-terminals-uniform-wishes.trycloudflare.com |
2025-11-10T11:28:31Z INF +--------------------------------------------------------------------------------------------+
-
4. Connect a Domain to Your Local Apache Server
Learn how to securely expose your local Apache server to the internet using Cloudflare Tunnel.
In case of Issue see how to make the initial Cloudflare Setup!
Contents