You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a LB4 application running on heroku. And 80% of the times it is giving me a CORS error
Access to XMLHttpRequest at 'https://aaaa' from origin 'https://bbbbb' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
The funny part is, sometimes the request DOES work and when it does it will work for a while. then afterwards it will start failing again.`In my index.ts I have set my CORS to allow everything but strangly this doesn't change anything
// Run the application
const config = {
rest: {
port: +(process.env.PORT ?? 3000),
host: process.env.HOST,
// The `gracePeriodForClose` provides a graceful close for http/https
// servers with keep-alive clients. The default value is `Infinity`
// (don't force-close). If you want to immediately destroy all sockets
// upon stop, set its value to `0`.
// See https://www.npmjs.com/package/stoppable
gracePeriodForClose: 5000, // 5 seconds
openApiSpec: {
// useful when used with OpenAPI-to-GraphQL to locate your application
setServersFromRequest: true
},
cors: {
origin: '*'
}
},
};
main(config).catch(err => {
console.error('Cannot start the application.', err);
process.exit(1);
});
}
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I have a LB4 application running on heroku. And 80% of the times it is giving me a CORS error
Access to XMLHttpRequest at 'https://aaaa' from origin 'https://bbbbb' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
The funny part is, sometimes the request DOES work and when it does it will work for a while. then afterwards it will start failing again.`In my index.ts I have set my CORS to allow everything but strangly this doesn't change anything
Beta Was this translation helpful? Give feedback.
All reactions