Answer the question
In order to leave comments, you need to log in
Why does CORS error only occur on prod (heroku)?
When requesting api from localhost, cors works correctly, on prod it gives an error:
Access to XMLHttpRequest at 'https://fit-helper-api.herokuapp.com/login' from origin 'https://fit-helper.herokuapp.com' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.
...
import * as cors from 'cors';
...
const app: express.Application = express();
...
// middleware
app.use(cors());
...
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question