Error 522 when fetching node.js Express API

I’m having trouble fetching my Express API that is running in a separate VPS with Nginx.

If I try to do this:


                const response = await fetch(
                    'https://srv****.hstgr.cloud:3000/'
                )

It returns 522 if it is running server side (in next-on-pages or any worker) but in client components (in the browser) it works just fine.

In express I have something like:

const app = express();

const port = 3000;

app.set('trust proxy', true);

app.use(

cors()

);
app.get('/', async (req, res) => {

res.status(200).json({ message: 'Request Accepted!' });

});

That makes me believe it is something related to security, so I tried deactivating ufw and also my VPS provider firewall.

However server side fetchs keep returning 522.

What else should I try?