Skip to main content

COMMUNITY KNOWLEDGE FORUM Independent Hosting Community • Not affiliated with netcup GmbH.

NETCUP GUIDE
FORUM · LIVE VOUCHER POOL
Tutorials LEVEL: Beginner TIME: 20 minutes // 16 MIN READ • VERIFIED:

How to Set Up Cloudflare on Netcup (Full Strict SSL, Real Visitor IPs & Origin Firewall Lock)

Placing Cloudflare’s Anycast CDN and Web Application Firewall (WAF) in front of your Netcup VPS or Root Server caches static assets at 300+ global edge PoPs and shields your origin IP. However, three mistakes plague 80% of Cloudflare deployments: using "Flexible" SSL (which sends unencrypted HTTP across the internet to Nuremberg/Vienna), logging Cloudflare edge IPs instead of real visitor IPs in Nginx/Fail2ban, and leaving ports 80/443 open to non-Cloudflare IPs so attackers can bypass your WAF entirely. This runbook fixes all three.

THREAD OP // AUTHOR Marcus Vance Principal Systems Architect
MOD VERIFIED // CO-MAINTAINER Elena Rostova Senior Network & Storage Verification Editor
THREAD STATUS // UPDATED Community Standards →
MODERATOR NOTE // TEST ENVIRONMENT & TRANSPARENCY Verified against Netcup CCP domain nameserver delegation, Cloudflare IPv4/IPv6 edge CIDR lists, and Nginx ngx_http_realip_module.

PREREQUISITES // ENVIRONMENT REQUIREMENTS

CHECKLIST
  • ✓ A Netcup VPS (such as a VPS 500 G12.5 or VPS 1000 G12.5) or Root Server (such as an RS 1000 G12.5) running Nginx or Caddy on ports 80 and 443
  • ✓ A domain registered at Netcup (or an external registrar) and a free Cloudflare account

Key Takeaways

EXECUTIVE BRIEFING
  • 01 Never use Cloudflare "Flexible" SSL—it causes redirect loops and transmits traffic unencrypted between Cloudflare and Netcup. Always use Full (Strict) with either Let’s Encrypt or a 15-Year Cloudflare Origin CA certificate.
  • 02 Configure an automated weekly script to populate /etc/nginx/conf.d/cloudflare-realip.conf so Nginx, application logs, and Fail2ban see the genuine visitor IP (CF-Connecting-IP).
  • 03 Enable Authenticated Origin Pulls (mTLS) or restrict inbound ports 80/443 in your firewall exclusively to Cloudflare’s official IPv4/IPv6 CIDR blocks so scanners cannot hit your Netcup IP directly.
📑 Quick Jump Table of Contents (3 Sections) ▼
§ 01

Step 1: Delegate Nameservers in Netcup CCP & Point Dual-Stack DNS Records

If your domain is registered through Netcup (including .de or .eu domains managed inside your customer account), log in to the Customer Control Panel (customercontrolpanel.de) → Domains → Select Domain → Name Server, choose Own name servers, and enter the two Cloudflare nameservers assigned to your zone (for example, ada.ns.cloudflare.com and bob.ns.cloudflare.com). Because Netcup’s AS197540 core routers maintain direct high-capacity settlement-free peering with Cloudflare at DE-CIX Frankfurt and VIX Vienna, sub-2 ms round-trip latency between Cloudflare’s German/Austrian edge PoPs and your Netcup KVM node ensures minimal proxy overhead on cache misses.

Pay strict attention to the DNSSEC chain of trust before modifying authoritative nameservers. If DNSSEC was previously enabled on Netcup’s default nameservers (root-dns.netcup.net / second-dns.netcup.net / third-dns.netcup.net), you must disable DNSSEC in CCP before switching nameservers and wait 15 to 30 minutes for the parent registry (such as DENIC for .de or Verisign for .com) to purge the old DS record. Switching nameservers while a stale DS record remains published at the TLD registry causes validating DNS resolvers (1.1.1.1, 8.8.8.8, ISP resolvers) to return SERVFAIL for every query to your domain.

Once Cloudflare confirms your zone is active, re-enable DNSSEC inside the Cloudflare dashboard (DNS → Settings → Enable DNSSEC) and copy the newly generated Key Tag, Algorithm (13 for ECDSAP256SHA256), Digest Type (2 for SHA-256), and Digest back into the Netcup CCP DNSSEC panel. When creating your origin records in Cloudflare, always provision both an IPv4 A record (203.0.113.10) and an IPv6 AAAA record (2a03:4000:xx:xx::1). Cloudflare’s edge acts as a transparent dual-stack protocol translator: an IPv6-only mobile visitor can connect to Cloudflare over IPv6 while Cloudflare fetches from your origin over IPv4 or IPv6, and vice versa.

Keep non-HTTP protocols isolated from proxied hostnames. Cloudflare’s standard Reverse Proxy ("Orange Cloud") only forwards HTTP and HTTPS traffic on standard web ports (80, 443, 2053, 2083, 2087, 2096, 8443). If you leave your primary apex domain @ proxied and attempt to run ssh [email protected] or connect a PostgreSQL/SMTP client to example.com, the connection will time out at Cloudflare’s edge. Always connect to SSH via a dedicated unproxied ("Grey Cloud" / DNS-only) subdomain such as ssh.example.com or directly via your server’s static IPv4/IPv6 address:

  • ▪ IPv4 Record: Type A, Name @ (and www), Content 203.0.113.10 (your Netcup IPv4 /32 address), Proxy status: Proxied.
  • ▪ IPv6 Record: Type AAAA, Name @ (and www), Content 2a03:4000:xx:xx::1 (your primary Netcup IPv6 address from your /64 block), Proxy status: Proxied.
  • ▪ SSH Subdomain Bypass: If you connect to SSH via a hostname, either connect directly to your raw IPv4/IPv6 address or create a separate ssh.example.com record set to DNS Only (Grey Cloud), as Cloudflare’s standard HTTP proxy only forwards HTTP/HTTPS ports.
§ 02

Step 2: Configure Cloudflare "Full (Strict)" SSL & Authenticated Origin Pulls (mTLS)

In the Cloudflare dashboard under SSL/TLS → Overview, set your encryption mode to Full (Strict). Never leave a zone on Flexible SSL: under Flexible mode, Cloudflare terminates HTTPS from the visitor’s browser at the edge PoP and opens a plaintext HTTP connection on port 80 across the public internet to your Netcup server. Aside from exposing session cookies, API bearer tokens, and passwords in cleartext over transit links, Flexible mode sends X-Forwarded-Proto: http to your origin—causing Nginx or WordPress (FORCE_SSL_ADMIN) to issue an unending 301 Moved Permanently redirect loop (ERR_TOO_MANY_REDIRECTS).

Under Full (Strict) mode, Cloudflare validates that the TLS certificate presented by your Netcup Nginx server on port 443 is signed by a trusted public Certificate Authority (such as Let’s Encrypt) or by Cloudflare’s Origin CA, has not expired, and matches the requested hostname in its Subject Alternative Name (SAN) extension. If your server strictly receives web traffic through Cloudflare, generating a 15-Year Cloudflare Origin CA Certificate under SSL/TLS → Origin Server → Create Certificate eliminates the need for 90-day ACME renewal cron jobs while supporting wildcard SANs (*.example.com, example.com).

However, DNS records and Certificate Transparency (CT) logs are public. Tools like Censys and Shodan continuously scan the entire IPv4 space (0.0.0.0/0), inspect TLS server certificates on port 443, and map domain names back to their underlying origin IPs—even if your domain has been behind Cloudflare from day one. Once an attacker discovers your Netcup IPv4 address, they can forge a direct curl --resolve example.com:443:203.0.113.10 https://example.com request, completely bypassing Cloudflare’s WAF, Bot Management, and DDoS rate limiting.

To cryptographically close this loophole, enable Authenticated Origin Pulls (mutual TLS / mTLS) in Nginx alongside your firewall rules. When you configure ssl_client_certificate with Cloudflare’s Authenticated Origin Pull Root CA (authenticated_origin_pull_ca.pem) and set ssl_verify_client on;, Nginx requires the connecting client during the TLS 1.3 handshake to present a valid client certificate signed by Cloudflare’s internal edge key. Any scanner or attacker hitting your Netcup IP directly fails the TLS client-certificate verification check and is terminated before a single HTTP header is parsed. For production deployments, combine mTLS with Cloudflare Smart Tiered Cache (Caching → Tiered Cache) so only upper-tier Cloudflare PoPs near Frankfurt (FRA) and Vienna (VIE) pull from your Netcup origin:

Cloudflare SSL/TLS Encryption Modes & Netcup Origin Security Matrix
Cloudflare SSL ModeEdge-to-Netcup TrafficOrigin Certificate ValidationProduction Verdict on Netcup
Off / FlexiblePlaintext HTTP (Port 80)None (Vulnerable to MITM & redirect loops)NEVER USE — Insecure & breaks HTTPS apps
FullEncrypted HTTPS (Port 443)Accepts self-signed certs without CN checkAvoid — Vulnerable to active origin spoofing
Full (Strict)Encrypted TLS 1.3 (Port 443)Strictly verifies Let’s Encrypt or Cloudflare Origin CARECOMMENDED BASELINE — End-to-end verified TLS
Full (Strict) + Authenticated Origin Pulls (mTLS)Mutual TLS 1.3 (Client + Server Cert)Verifies Origin Cert + Cloudflare Client CertificateGOLD STANDARD — Blocks direct-to-IP WAF bypasses
Download Cloudflare Authenticated Origin Pull CA & Enable mTLS in Nginx
bash
# Download Cloudflare's official Authenticated Origin Pull Root CA certificate
sudo mkdir -p /etc/nginx/certs
sudo curl -fsSL https://developers.cloudflare.com/ssl/static/authenticated_origin_pull_ca.pem \
  -o /etc/nginx/certs/cloudflare-origin-pull-ca.pem

# Inside your /etc/nginx/sites-available/example.com.conf server { listen 443 ssl; ... } block, add:
# ssl_client_certificate /etc/nginx/certs/cloudflare-origin-pull-ca.pem;
# ssl_verify_client on;

sudo nginx -t && sudo systemctl reload nginx

Command Explanation: Installs Cloudflare’s client certificate authority and enforces mTLS verification so direct IP scanners probing your Netcup IPv4 address receive 400 Bad Request (No required SSL certificate was sent).

EXPECTED OUTPUT
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
§ 03

Step 3: Automatically Restore Real Visitor IPs in Nginx (ngx_http_realip_module)

Because Cloudflare acts as a reverse proxy at the TCP layer, every packet arriving at your Netcup server’s eth0 interface carries a Cloudflare edge node IP (172.64.0.0/13, 104.16.0.0/12, 2606:4700::/32) as its Layer-3 source address. In a default Nginx installation, the internal $remote_addr variable is populated directly from the TCP socket peer address. Without explicitly configuring ngx_http_realip_module, your /var/log/nginx/access.log files will attribute every request to Cloudflare’s Frankfurt or Vienna PoP IPs rather than the actual end user.

This creates a dangerous operational failure mode when paired with host-level rate limiting (limit_req_zone $binary_remote_addr) or Fail2ban log filters. If a single malicious bot triggers your login rate limit or Fail2ban jail while $remote_addr still resolves to a Cloudflare edge IP, Nginx or UFW will block that Cloudflare PoP IP—instantly blackholing thousands of legitimate visitors routed through the same Cloudflare datacenter.

Never solve this by reading HTTP_CF_CONNECTING_IP or HTTP_X_FORWARDED_FOR directly in PHP/Node.js without network-layer validation. HTTP request headers are trivial for an attacker to forge (curl -H "CF-Connecting-IP: 127.0.0.1"). Instead, use Nginx’s compiled-in ngx_http_realip_module: by listing Cloudflare’s official IPv4 and IPv6 CIDR ranges via set_real_ip_from directives and setting real_ip_header CF-Connecting-IP;, Nginx will only overwrite $remote_addr and $binary_remote_addr when the underlying TCP connection genuinely originated from a trusted Cloudflare edge subnet.

Adding real_ip_recursive on; ensures that if a request passes through multiple trusted proxy hops (for instance, Cloudflare edge → your host Nginx proxy → an internal Docker container), Nginx strips trusted proxy addresses right-to-left until it isolates the first untrusted client IP. Create the automated script below to fetch Cloudflare’s official IPv4 and IPv6 CIDR lists, validate them atomically in a temporary file, and generate /etc/nginx/conf.d/cloudflare-realip.conf:

/usr/local/sbin/update-cloudflare-realip.sh (Automated Nginx RealIP Generator)
bash
cat << 'EOF' | sudo tee /usr/local/sbin/update-cloudflare-realip.sh
#!/usr/bin/env bash
set -euo pipefail

CONF_FILE="/etc/nginx/conf.d/cloudflare-realip.conf"
TMP_FILE="$(mktemp)"

echo "# Auto-generated Cloudflare RealIP configuration ($(date -u +%Y-%m-%dT%H:%M:%SZ))" > "${TMP_FILE}"

for ip in $(curl -fsSL https://www.cloudflare.com/ips-v4); do
  echo "set_real_ip_from ${ip};" >> "${TMP_FILE}"
done

for ip6 in $(curl -fsSL https://www.cloudflare.com/ips-v6); do
  echo "set_real_ip_from ${ip6};" >> "${TMP_FILE}"
done

echo "real_ip_header CF-Connecting-IP;" >> "${TMP_FILE}"
echo "real_ip_recursive on;" >> "${TMP_FILE}"

mv "${TMP_FILE}" "${CONF_FILE}"
chmod 0644 "${CONF_FILE}"
nginx -t && systemctl reload nginx
EOF

sudo chmod +x /usr/local/sbin/update-cloudflare-realip.sh
sudo /usr/local/sbin/update-cloudflare-realip.sh

Command Explanation: Downloads Cloudflare’s live IPv4 (ips-v4) and IPv6 (ips-v6) ranges, writes set_real_ip_from directives into /etc/nginx/conf.d/cloudflare-realip.conf, and tells Nginx to trust CF-Connecting-IP only when the packet arrives from an official Cloudflare IP.

EXPECTED OUTPUT
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
Never Trust CF-Connecting-IP Without set_real_ip_from

If your web app reads the HTTP_CF_CONNECTING_IP header directly without Nginx set_real_ip_from CIDR validation, an attacker connecting directly to your Netcup IP can spoof arbitrary X-Forwarded-For / CF-Connecting-IP headers to bypass rate limits.

Common Troubleshooting Scenarios

DIAGNOSTIC RUNBOOK

[SYMPTOM] Cloudflare displays Error 521: Web Server Is Down or Error 522: Connection Timed Out

Root Cause: Either Nginx is not listening on port 443 on your Netcup server, or Fail2ban / UFW / the Netcup SCP Firewall accidentally blocked one of Cloudflare’s edge IP ranges.

Resolution: Verify that ports 80/tcp and 443/tcp are allowed in both the Netcup SCP Firewall and UFW, and check sudo fail2ban-client status to ensure no Cloudflare 172.64.0.0/13 or 104.16.0.0/12 range was jailed before cloudflare-realip.conf was enabled.

[SYMPTOM] Cloudflare displays Error 526: Invalid SSL Certificate

Root Cause: Cloudflare SSL/TLS is set to Full (Strict), which is correct, but your Netcup server is still serving a self-signed snakeoil certificate or an expired Let’s Encrypt cert.

Resolution: Either install a 15-Year Cloudflare Origin CA certificate in Nginx or run sudo certbot renew so the origin certificate matches your domain name.

[SYMPTOM] Large file uploads (>100 MB) fail with Error 413 when Cloudflare Orange Cloud is enabled

Root Cause: Cloudflare’s Free and Pro plans enforce a 100 MB maximum per-request HTTP POST body upload limit at the CDN edge.

Resolution: Either implement chunked/tus.io multi-part uploads in your web application, upload directly to S3/R2 via presigned URLs, or use an unproxied ("Grey Cloud") subdomain for heavy admin media uploads.

Frequently Asked Questions

VERIFIED Q&A

Can I keep my domain registered at Netcup while using Cloudflare DNS and CDN?

Yes! You do not need to transfer your domain registration away from Netcup (including any .de or .eu domains bundled with Netcup Webhosting plans). Simply change the authoritative nameservers inside the Netcup Customer Control Panel (CCP) to the two nameservers assigned by your Cloudflare zone.

Does Certbot HTTP-01 renewal still work when the Cloudflare Orange Cloud proxy is enabled?

Yes, as long as your Nginx port 80 block forwards /.well-known/acme-challenge/ or you use the python3-certbot-dns-cloudflare DNS-01 plugin or a 15-Year Cloudflare Origin CA certificate.

Should I enable Cloudflare on top of an entry-level Netcup VPS nano G11.5s?

Absolutely. Offloading static images, CSS, JS, and TLS handshakes to Cloudflare’s global edge allows even a compact 2 GB ECC RAM Netcup VPS nano G11.5s to absorb massive traffic spikes while reserving local CPU and memory exclusively for dynamic application queries.

How do I schedule update-cloudflare-realip.sh so Cloudflare IP ranges stay updated automatically?

Add a weekly cron job via echo "15 3 * * 1 root /usr/local/sbin/update-cloudflare-realip.sh >/dev/null 2>&1" | sudo tee /etc/cron.d/cloudflare-realip so Nginx refreshes Cloudflare’s IPv4/IPv6 CIDR list every Monday at 03:15 UTC.

REFERENCES // VERIFIED TECHNICAL SOURCES

FURTHER READING // ARCHITECTURE AUDITS & GUIDES

Active Coupons →