How to Set Up a Cloudflare Reverse Proxy for Your FiveM Server
Enhance your FiveM server with a free Cloudflare reverse proxy to improve performance and security.
Author: Goodleaf Hosting
Setting up a Cloudflare reverse proxy allows you to improve your FiveM server’s performance, protect against DDoS attacks, and reduce bandwidth usage. This guide will walk you through the process step-by-step.
Benefits of a Cloudflare Reverse Proxy
- Improved Load Times: Leverage Cloudflare’s global Content Delivery Network (CDN) for faster access worldwide.
- Enhanced DDoS Protection: Extra security to prevent server downtime during attacks.
- Traffic Optimization: Minimize traffic congestion.
- Bandwidth Reduction: Reduce strain on your server by caching assets.
Setup Instructions
Step 1: Sign Up for a Cloudflare Account
- Go to Cloudflare’s signup page.
- Create an account and verify your email address.
Step 2: Get a Domain or Manage Your Current DNS
- If you don’t already have a domain, purchase one from a domain registrar.
- Goodleaf Hosting offers domains—order here.
Step 3: Add Your Domain to Cloudflare
-
Log in to Cloudflare:
- Go to the dashboard and click Add a Site.
-
Choose a Plan:
- Scroll down and select the Free Plan for basic functionality.
-
Update Nameservers:
- Cloudflare will provide nameservers (e.g.,
ns1.cloudflare.com
andns2.cloudflare.com
). - Replace your registrar's current nameservers with the ones provided by Cloudflare.
- Cloudflare will provide nameservers (e.g.,
-
Disable DNSSEC:
- Before changing nameservers, ensure DNSSEC is disabled in your domain settings.
-
Wait for DNS Propagation:
- DNS updates can take 1–24 hours. Cloudflare will notify you when your domain is active.
Step 4: Enable DNSSEC in Cloudflare
Once your domain is active, re-enable DNSSEC within Cloudflare to protect against domain spoofing.
Configure DNS Settings for Your FiveM Server
Step 1: Add an A Record
-
Navigate to the DNS section in Cloudflare.
-
Add an A Record:
- Type: A
- Name: Your desired subdomain (e.g.,
play
). - IPv4 Address: Your server’s IP address (e.g.,
123.456.78.90
). - Proxied: Enable for Cloudflare protection. If players experience connection issues, disable Proxied, but this will expose your server’s IP address.
-
Click Save.
Step 2: Add an SRV Record
-
Add an SRV Record:
- Type: SRV
- Name: Subdomain (e.g.,
play.yourdomain.com
). - Service:
_cfx
- Protocol: UDP
- TTL: Auto
- Priority: 10
- Weight: 10
- Port:
30120
(or your server’s port). - Target: Your subdomain (e.g.,
play.yourdomain.com
).
-
Click Save.
Using Your Custom Domain
- Players can now connect using your custom domain (e.g.,
play.yourdomain.com
) instead of the default CFX URL. - Allow up to 2–4 hours for the DNS changes to propagate fully.
How Players Should Connect:
- Open the F8 Console in FiveM.
- Type:
connect play.yourdomain.com
- This ensures they benefit from Cloudflare’s CDN and DDoS protection.
Additional Tips
- Port Forwarding: Ensure your server ports (e.g.,
30120
) are open and accessible through your firewall. - Backup Configuration: Save your DNS records and configuration details in case you need to migrate servers.
- Test Connectivity: Verify that players can connect to your server using the custom domain.
Final Thoughts
Setting up a Cloudflare reverse proxy for your FiveM server is an effective way to boost performance and protect against attacks. By following this guide, you can provide a smoother, more secure experience for your players.
Need help with hosting? Goodleaf Hosting offers high-performance FiveM hosting with built-in DDoS protection and expert support. Upgrade your server today!