Cloudflare On Gameservers


#1

Hello, i was playing on an minecraft server, and then i was going to see the network that they have, and i see cloudflare ip so i was what? Because cloudflare just support HTTP / HTTPS Traffic, as you can see on the screenshot was on port 25565, so explain me that, and what function they used?!


#2

Possibly an enterprise customer using Spectrum.

Since it looks like Minecraft: @matteo any idea? :wink:


#3

I found tho, it’s the server that i was


#4

As expected :slight_smile:


#5

Yeah, Spectrum is awesome… Expensive though! I used it in the beta for SSH.

It is true that now using Workers you can connect via HTTP/HTTPS to non-standard ports as long as on the customer side you fall inside Cloudflare’s standard ports.

@MarkMeyer what made you think Minecraft -> Matteo?! :joy:


#6

IIRC you told someone that you have a trick for Minecraft and I expected a second question from the TO :wink:


#7

I don’t believe it was me… :sweat_smile:


#8

:thinking: well, then. Sorry ^^


#9

No worries!

I think I once said something about never having used a Minecraft server, but this wasn’t backend stuff, so could have worked…


#10

Thanks for the help guys!


#11

How might one do that using Workers so you can connect via HTTP/HTTPS to non-standard ports as long as on the customer side you fall inside Cloudflare’s standard ports.


#12

It’s pretty simple actually. I will post here the whole thing:

addEventListener('fetch', event => {
  event.respondWith(handleRequest(event.request))
})

/**
 * Fetch and log a request
 * @param {Request} request
 */
async function handleRequest(request) {
  var newURL = new URL(request.url)
  newURL.port = '5000' // Here you select the port you want in the backend

  return fetch(newURL, request)
}

You will need to enable the routes in Workers (or additional methods, like multiple addEventListener with filters inside so that only one executes event.respondWith) to filter it to your single domain/subdomain.


#13

This topic was automatically closed after 14 days. New replies are no longer allowed.