Fetch request being blocked by cors policy when GET request is sending a specific value

I have a website which is using the Vue.js framework which connects to a django api. The django api has the following settings:

MIDDLEWARE = [ .. "corsheaders.middleware.CorsMiddleware", .. ] CORS_ALLOWED_ORIGINS = ["http://localhost:3000", 'http://127.0.0.1:3000']

The following request works fine: fetch("http://127.0.0.1:8000/select?user_sent=1")

However this request causes an error: fetch("http://127.0.0.1:8000/select?user_sent=2")

The error caused by the second request: Access to fetch at 'http://127.0.0.1:8000/select?user_sent=2' 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.

The weird thing is that the second request used to work before. I made a change to my django urls and changed the name of the select path but then changed it back to select and now it is no longer working.

I tried changing the name of the select path to /sele and when I do that the request will work fine on the new path. However, I would like to know why it is not working on the /select path.

Back to Top