Skip to content

10% off shop orders, applied at checkoutBlack Friday: 30% off until Dec 1Server templatesServer templates

RPScripts

FiveM DDoS Protection: Hide Your Server and Survive an Attack

By Luke

How To Protect your FiveM Server from DDoS
On this page

FiveM DDoS protection has to happen before the traffic reaches your machine: at your host's network or at a proxy that carries the FiveM connection for you. A firewall on the server itself cannot help once the line is full. This guide shows where FiveM exposes your address, what a host's mitigation must cover, how self-hosters put a proxy in front of FXServer with the settings Cfx.re documents, and what to do during and after an attack.

The short version:

  1. Write down every address that reaches your server: the game endpoint, txAdmin, the database, a website or bot on the same machine, and old IPs.
  2. Rent from a host whose mitigation covers FiveM's TCP and UDP traffic on your game port, or put a TCP/UDP proxy in front of the server.
  3. Stop the server list from advertising your real IP with sv_forceIndirectListing, and send players to the proxy with sv_endpoints.
  4. Close everything except the game port to the public; reach txAdmin, SSH, RDP and the database through a restricted path.
  5. If the old IP was ever public, move to a new one that has never been published.
  6. Record a normal baseline and keep a short incident runbook with your host's escalation contact.

What a DDoS attack does to a FiveM server

A distributed denial-of-service attack sends more traffic than the network path or the service can handle. For a FiveM server, that shows up in two ways:

  • Volumetric floods fill the network link or the host's router before any packet reaches FXServer. Players time out together, the server drops off the list, and nothing on the machine can fix it, because the problem is upstream.
  • Application floods hit FXServer's HTTP endpoints, such as info.json, players.json and the connection handshake, or flood connection attempts. The line may be fine, but the server spends its time answering junk.

Every attack needs a target address. Anyone who can find your server's real IP, from the server list, a connection or an old post, can aim traffic straight at it. That is why hiding the origin matters as much as filtering.

Is it an attack or a crash?

Check before you change anything. A broken resource and a flood can look the same from a player's point of view.

SignPoints to a network attackPoints to a server problem
Who is affectedEvery player, txAdmin and SSH lag or drop at the same momentPlayers time out, but txAdmin and SSH respond normally
Host's network graphIncoming traffic or packet rate far above your normal baselineTraffic at its usual level
Server consoleFew errors; the server simply loses its clientsScript errors, hitch warnings or a crash right before the drop
TimingStarts suddenly; it can follow a ban, a dispute or an announcementFollows an update, a restart or a new resource

For the server side, read the txAdmin and FXServer logs first, and use the guide for when FXServer is not responding if the console points to a resource.

How FiveM connects players, and where your IP leaks

The Cfx.re proxy documentation separates two endpoints. Out of the box, both are on port 30120.

  • The connect endpoint is HTTP over TCP. The client fetches /info.json, sends its connection request to /client, and asks it which game address to use.
  • The server endpoint carries the game itself over UDP, plus TCP for configuration and, unless you move them, resource downloads under /files/.

Every path that hands out the real address of either endpoint defeats your protection. Check each one:

LeakWhy it exposes youFix
Server listBy default the list advertises the server's real IPsv_forceIndirectListing true with sv_listingHostOverride pointing at your proxy
Game endpointEvery client that passes the connection step receives the addresses in sv_endpoints; empty means the auto-detected public IPSet sv_endpoints to your TCP/UDP proxy, not the origin
Resource downloadsFiles are served from the server endpoint unless a file server is setfileserver_add to a proxied host, as in the Cfx.re example
txAdminThe web panel listens on port 40120 by defaultDo not expose it publicly; use an SSH tunnel, a VPN or an IP allowlist
Same-machine servicesA website, Discord bot, mail server, database or game panel on the same IP reveals itMove them to other machines or behind the proxy
Old IPs and DNS historyAddresses you used before stay in players' history, old posts and DNS history servicesGet a new IP that has never been published once protection is in place

Note: a connect proxy alone does not hide your server. Players still receive the game address from sv_endpoints, so the origin stays visible to anyone who joins. Only a TCP/UDP proxy or a host's network filtering covers the game traffic.

Option 1: rent a host with real FiveM DDoS protection

For most communities this is the simplest route. The host filters traffic in its own network, before it reaches your machine. "DDoS protection included" means little without details, so ask before you pay:

  1. Does the mitigation cover UDP and TCP on the game port you use, not only the website or the panel?
  2. Is filtering always on, or does it start only after an attack is detected? How long does detection take?
  3. Is there a filtering profile for game traffic or for FiveM specifically, and can it be adjusted if it blocks real players?
  4. What happens when an attack exceeds the limit: is the IP null-routed, and for how long?
  5. Do you get a traffic graph and attack notifications, and how do you reach support during an incident?
  6. Can you get a fresh IP if the current one is leaked, and what does it cost?
  7. Where is the filtering located? A scrubbing center far from your players adds latency.

Take capacity figures as the provider's own claim, and ask for the terms in writing. Our FiveM hosting provider comparison sets panels, backups and network scope side by side, and VPS versus dedicated server explains what changes when you manage the machine yourself.

Option 2: put a proxy in front of your own server

If you run FXServer at home, on a VPS without game filtering, or want to keep your current machine, Cfx.re documents a reverse-proxy setup. The proxy machine can be a small Linux VPS even when the game server runs Windows. To actually absorb attacks, that proxy must sit in a network with DDoS filtering for TCP and UDP, or be a dedicated game-protection service.

A third variant works the same way: a protected IP from a mitigation service, delivered to your machine through a tunnel such as GRE. Players connect to the protected address, and the service forwards clean traffic. The leak checks above apply unchanged. If you host from home, any of these routes matters even more: without one, your residential IP is the target, and a home connection has no attack filtering of its own.

What Cloudflare can and cannot do

A proxied Cloudflare DNS record carries HTTP and HTTPS, and only on Cloudflare's listed ports, such as 443; port 30120 is not one of them. That is enough for the connect endpoint: Cfx.re's example uses a proxied record and nginx on port 443. The game traffic is raw UDP, which Cloudflare's normal proxy does not carry; Cloudflare's own documentation lists Spectrum for all TCP and UDP ports as an Enterprise feature. With a free or Pro plan, Cloudflare protects the join step only, and you still need a TCP/UDP proxy or a filtering host for the game.

The settings Cfx.re documents

These values go into server.cfg. Replace the example addresses with your own proxy and origin. This excerpt comes from the Cfx.re proxy setup page; it was checked against that documentation, not executed on a test server for this guide.

# do not advertise the real IP on the server list
set sv_forceIndirectListing true
# the server list queries https://play.example.com/ instead
set sv_listingHostOverride "play.example.com"
# proxy addresses allowed to pass X-Real-IP (and bypass the rate limiter)
set sv_proxyIPRanges "203.0.113.10/32"
# the address players receive for game traffic: your TCP/UDP proxy
set sv_endpoints "203.0.113.20:30120"

sv_proxyIPRanges must contain only your own proxy addresses. Any address in that list can claim to be a different player IP and skips the rate limiter, so a wide range here weakens your protection. If you never set it, FXServer trusts all private and loopback ranges (10.0.0.0/8 127.0.0.0/8 192.168.0.0/16 172.16.0.0/12), so set it explicitly. sv_listingIpOverride is needed only when the server list backend cannot work out the address itself, for example on a machine with several IPs, or once the origin is firewalled off for everyone except your proxy, as in the next section. Cfx.re notes that this value is not handed to connecting clients.

For the game traffic, the Cfx.re page shows an nginx stream block that forwards TCP and UDP on port 30120 to the origin. It must sit at the top level of the nginx configuration, outside the http { } block, so not in a sites-enabled file. On Debian and Ubuntu, conf.d is loaded inside http { }, so put it in nginx.conf itself; some distributions also need the stream module package (libnginx-mod-stream). Run nginx -t before you reload:

stream {
  upstream backend { server 198.51.100.5:30120; }
  server { listen 30120; proxy_pass backend; }
  server { listen 30120 udp reuseport; proxy_pass backend; }
}

Once the proxy is in place, the following should open in a browser through your domain: /info.json, /players.json, /dynamic.json, and /client answering that it accepts POST only. Players then join with connect "https://play.example.com/" or a join link; the Cfx.re page notes that a bare domain is not looked up as a URL.

Behind a plain stream proxy, FXServer sees the proxy's address for every player's game connection, so IP-based bans and logs no longer show real player IPs. Ban by player identifiers instead.

Lock the origin to the proxy

A proxy only helps if the origin refuses everyone else. Back up your firewall rules first and keep a second way into the machine, such as the host's web console, before you change them. Then:

  1. Allow port 30120 TCP and UDP only from the proxy addresses.
  2. Allow SSH or RDP only from your own addresses or a VPN.
  3. Keep txAdmin and the database off the public internet; reach txAdmin through an SSH tunnel.
  4. Test a real player join through the proxy and an admin connection before you end the maintenance window. If anything fails, restore the saved rules.

If your host has a firewall in its control panel, use it in addition to the one on the machine: traffic it drops never reaches your server's network interface. Our guide to server.cfg settings shows where these lines sit in the full file, and the Linux versus Windows comparison covers the firewall tools on each system.

Settings inside FXServer that reduce the damage

None of these stop a flood that fills your line, but they make application-level abuse cheaper to absorb.

  • Rate limiters: FXServer limits HTTP info requests, handshakes, net events and state bags with token buckets. Each one has a rate and a burst you can change with set rateLimiter_<name>_rate and _burst. Leave the defaults unless you have measured a reason; raising them lets more junk requests through.
  • sv_requestParanoia: counters proxy-based HTTP floods by blocking the sending IP. Level 1 blocks IPs whose requests carry a Via header. Level 2 also blocks requests with an Upgrade-Insecure-Requests header, which includes every browser opening a .json endpoint, and from level 2 on info.json, dynamic.json and players.json answer "Nope.". Level 3 also closes the socket. Run the browser checks above before you raise it, and test it outside peak hours.
  • sv_endpointPrivacy true: hides player IP addresses from the server's public reports, so players are not exposed to attacks after they join your server.
  • sv_httpFileServerProxyOnly true (server 10543 and newer): once downloads go through fileserver_add, the file server answers only addresses in sv_proxyIPRanges, so /files/ cannot be pulled from the origin directly. Cfx.re also documents generate_handshake_key and load_handshake_key for proxies that verify handshakes before they reach the server; keep that key private.
  • Local TLS proxy: when you cannot tunnel TLS through a service such as Cloudflare, Cfx.re describes moving FXServer's TCP endpoint to an internal port and putting nginx with TLS in front of it on 30120, then blocking the internal port from outside. List endpoint_add_udp "0.0.0.0:30120" before endpoint_add_tcp "0.0.0.0:30121"; otherwise the change does not apply.

A "FiveM anti-DDoS" Lua resource cannot replace any of this. Resources run inside FXServer, after the traffic has already reached the machine and used the bandwidth. Scripts that claim to block attacks by IP can at best drop some connection attempts, and an unknown script with network access is a risk in itself: run downloads through the FiveM backdoor scanner before you start them.

Incident runbook: what to do during an attack

Prepare this before you need it, and keep it outside the server: in a shared document or your staff Discord.

  1. Confirm it is the network. Check the host's traffic graph and whether SSH and txAdmin respond, using the table above.
  2. Tell your players on a channel that does not depend on the server, such as Discord, that you know and are working on it.
  3. Open a ticket with your host or protection provider. Give the service ID, the attacked IP and port, the start time in UTC and the graph. Ask whether mitigation is active and whether the IP is null-routed.
  4. Do not restart resources or the server to "fix" a flood; it makes your logs harder to read and does not reduce traffic.
  5. Write down the timeline: UTC times, affected endpoints, traffic numbers and provider incident IDs. Do not post player identifiers, secrets or raw packet captures in public channels.
  6. If the attack hits an address you thought was hidden, one of the leaks above is still open. Find it before you move to a new IP, or the new one leaks the same way.

After the attack

  • Confirm that players can join and that the game, txAdmin and the database are healthy before you announce the all-clear.
  • Check whether the traffic reached an old origin path, and whether the mitigation covered the protocol that was used.
  • Rotate to a new IP if the old one is burned, and update only the proxy and DNS, never public posts.
  • If the attack came with a break-in, restore from backups of your database and resources taken before it started.
  • Update your baseline and runbook with what you learned.

Frequently asked questions

Can a FiveM server be DDoS protected for free?

Partly. A free Cloudflare plan can proxy the HTTP connect endpoint, and FXServer's rate limiters cost nothing. The UDP game traffic needs network filtering, which comes from your host or a paid protection service.

Does hiding my IP stop all attacks?

It stops attacks on your origin as long as no path leaks it. The proxy or the host's filter then takes the attack instead, so it still needs enough capacity and a filter that understands FiveM traffic.

Will a proxy add ping?

Every extra hop adds some latency. Choose a proxy or scrubbing location close to both your players and your server.

Does txAdmin protect against DDoS?

No. txAdmin manages and monitors the server. Keep its port 40120 off the public internet so attackers cannot reach the admin panel or try logins on it.

Should I change my IP after an attack?

Only after the leak is closed and protection is in place. Otherwise the new address is found the same way as the old one.

Reference documentation

Technical source review: 13 November 2026. This article was checked against the linked documentation; the commands and configurations were not executed on a test server for this review.

  • How to Diagnose and Reduce FiveM Join Times

    How to Diagnose and Reduce FiveM Join Times

    To shorten FiveM join times, measure where the delay occurs first: queue or authentication, resource download, game loading, or character initialization. A faster loading-screen animation does not shorten the underlying work.

  • What Does VDM Mean in FiveM Roleplay?

    What Does VDM Mean in FiveM Roleplay?

    VDM usually means Vehicle Deathmatch: using a vehicle to attack another character without the roleplay justification or initiation required by the server. A collision alone does not establish VDM; accidents, desync and permitted pursuit tactics need context.

  • How to Diagnose a FiveM “Failed to Inflate” Error

    How to Diagnose a FiveM “Failed to Inflate” Error

    “Failed to Inflate” means data could not be decompressed. Record the complete error and any named file or resource before clearing cache or changing server settings. The same phrase can come from different causes.