How to Set Up a Cloudflare Tunnel for Local n8n (2025)

3 min read 6 days ago
Published on Aug 31, 2025 This response is partially generated with the help of AI. It may contain inaccuracies.

Table of Contents

Introduction

In this tutorial, you'll learn how to set up a Cloudflare Tunnel for your locally hosted n8n instance. This setup will enable you to access n8n from any browser or device, allowing for seamless integration with third-party services like Google APIs. By following these steps, you'll ensure your workflows are accessible and secure.

Step 1: Set Up Your Cloudflare Domain

  1. Create a Cloudflare Account: If you don't have one, sign up at Cloudflare.
  2. Add Your Domain: Follow the prompts to add your domain to Cloudflare.
  3. Configure DNS Settings:
    • Go to the DNS settings of your domain.
    • Create a new DNS record for your n8n instance.
    • Choose the type as "A" and point it to your local IP address.

Step 2: Install Cloudflare Tunnel

  1. Install Cloudflare's Command Line Interface (CLI):

    • Use the following command to install the cloudflared tool:
      brew install cloudflared
      
    • For Windows users, download the executable from the Cloudflare website.
  2. Authenticate with Cloudflare:

    • Run the following command:
      cloudflared login
      
    • This will open a browser window to authenticate your Cloudflare account.
  3. Create a Tunnel:

    • Execute the command to create a new tunnel:
      cloudflared tunnel create your_tunnel_name
      
  4. Configure the Tunnel:

    • Create a configuration file named config.yml in the ~/.cloudflared/ directory.
    • Add the following content:
      tunnel: your_tunnel_id
      credentials-file: /path/to/your/credentials.json
      
      ingress:
        - hostname: your_subdomain.your_domain.com
          service: http://localhost:5678
        - service: http_status:404
      

Step 3: Understand What a Tunnel Is

  • A Cloudflare Tunnel securely connects your local server to the Cloudflare network, allowing external access without exposing your local IP address. This is particularly useful for services like n8n that run on localhost.

Step 4: Set Up Public Hostname

  1. Configure the Hostname in Cloudflare:

    • In your Cloudflare dashboard, navigate to the “Tunnels” section.
    • Click on your tunnel and add the public hostname you configured earlier.
  2. Verify the Setup:

    • Ensure the DNS record is proxied (orange cloud icon).
    • Test the hostname in a browser to check if it's reachable.

Step 5: Change Webhook URL to Public

  1. Update Webhook URLs in n8n:
    • Access your n8n instance.
    • Navigate to the settings and update any webhook URLs to point to your new public hostname.

Step 6: Reset Docker Container

  1. Restart n8n:
    • If n8n is running in a Docker container, restart it to apply changes:
      docker restart n8n
      
    • Ensure that the new configurations are loaded properly.

Conclusion

By following these steps, you've successfully set up a Cloudflare Tunnel for your n8n instance, making it accessible from anywhere while maintaining security. You can now integrate with various APIs and manage workflows remotely.

For your next steps, consider exploring additional integrations within n8n or diving deeper into Cloudflare's features to enhance your setup.