KoalaBotUK / KoalaBot

🐨 All in one Discord bot for student societies & communities
https://KoalaBot.uk
MIT License
11 stars 8 forks source link

Python API Access-Control-Allow-Origin missing (CORS) #417

Closed VottonDev closed 1 year ago

VottonDev commented 1 year ago

Describe the bug

The Python API lacks the Access-Control-Allow-Origin header.

209.189.115.62:20051/react-for-role/required-roles?guild_id=863362407183286302' from origin 'http://localhost:3000' 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.

To Reproduce

  1. Run the frontend dashboard.
  2. Go to http://localhost:3000/dashboard/reactforrole
  3. Open network tab and filter by Fetch/XHR
  4. Look at the required_roles request that shows up as red.

Expected behaviour

Have the Access-Control-Allow-Origin header like the internal frontend API:

image

Screenshots

image

Additional context

It is possible to debug this with Postman, as Postman returns the headers after a GET request is made.

image