CORS issue when frontend tries to send api request to backend

Netlify frontend URL:
My Render backend URL:

It leads to a sign-in page. However, when I try to sign in, I get the following error -

My app.ts file -

import { Server } from "@overnightjs/core";
import { initDB } from "./models";
import { ApiController } from "./controllers/ApiController";
import * as bodyParser from "body-parser";
import session from "express-session";
import cookieParser  from "cookie-parser";
import * as http from 'http';
import cors from 'cors';

export class App extends Server {
	private close: http.Server;

	constructor() {
		// setting up session
				secret: "secret",
				resave: true,
				saveUninitialized: true,
				cookie: {maxAge: 60 * 1000 * 300},
				rolling: true // reset exipration date with every request

	public start(): void {
		const port = 10000;, res, next) => {
			res.header('Access-Control-Allow-Origin', '*');
			res.header('Access-Control-Allow-Headers', 'Origin, X-Requested-With, Content-Type, Accept');

		// Enable CORS for all routes;

		// Use the cookie-parser middleware;

		this.close =, () => {
            console.log('Server listening on port: ' + port);


	private applyMiddleWares() {;{ extended: false }));

	private async boostrap() {
		// Connect to db
		await initDB();

	private setupControllers() {
		super.addControllers(new ApiController());

The issue is that the backend isn’t sending the appropriate headers in the preflight request. This is not an issue with the frontend on Netlify.

All of your CORS headers appear to be defined correctly within the start method, but I don’t see this being called anywhere. Maybe you intended to call this.start(); within the constructor?

I’ve added this.start(); in the constructor but now I get this error -

I’ve changed the port to 3001 and 4000 but I get the same error.

Are you trying to run this on render?

the backend is running on render…it is fully functional

As mentioned by @jasiqli, this is not a Netlify issue. You can always use Rewrites: Rewrites and proxies | Netlify Docs to make the browser believe these are same-origin requests.