I’m getting the following cors error when making a fetch call from one sub domain to another sub domain on the same server.
Access to fetch at 'https://prod.example.com/' from origin 'https://dev.example.com' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
The prod Server has the following code:
// allow localhost to talk to remote server
const cors = require("cors");
app.use(cors());
app.use(function(request: Request, response: Response, next: Function) {
response.header("Access-Control-Allow-Origin", "*");
next();
});
As you can see I specifically have that header added.
I’ve tried with and without the cors class:
app.use(cors());
I’ve read multiple posts and even followed this guide and I’m at a loss. It’s been multiple days now. I haven’t seen the sun. I don’t know what time it is. There’s about 20 ramen cups scattered across the floor. My cat has climbed into the air conditioning. My bath room mirror has CORS was here smeared across it in siracha sauce. I don’t remember writing it.