App hosting

Web app with your domain

Run a site or an API on your allocated port and open it with a domain name.

Your App Hosting server has an IP address and an allocated port, both shown in the panel. A web app must listen on exactly that port and on all interfaces (0.0.0.0), or it cannot be reached from outside.

  1. Listen on the allocated port

    Pterodactyl puts the port in the SERVER_PORT environment variable. Use it in your code:

    index.js
    js
    const express = require('express');
    const app = express();
     
    app.get('/', (req, res) => res.send('Hello from RHQ!'));
     
    const port = process.env.SERVER_PORT || 3000;
    app.listen(port, '0.0.0.0', () => console.log(`Running on port ${port}`));

    Add "express": "^4.21.0" to dependencies in package.json.

  2. Start and test

    Click Start, then open http://SERVER_IP:PORT in your browser, with the values from the panel.

  3. Add your domain

    In Cloudflare, under DNS → Records, add:

    TypeNameContentProxy
    AappSERVER_IPDNS only (grey cloud)

    Your app is now at http://app.yourdomain.com:PORT.

Why the orange cloud does not work here

The Cloudflare proxy accepts only certain ports: 80, 8080, 8880, 2052, 2082, 2086, 2095 for HTTP and 443, 2053, 2083, 2087, 2096, 8443 for HTTPS. If your allocated port is not one of them, keep the record on DNS only.