CORS setup

When I'm using Manifest (localhost:1111) from my frontend (localhost:3000) and call some collection endpoints, I receive
Access to fetch at 'http://localhost:1111/api/collections/my_entity' from origin 'http://localhost:3000' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: The value of the 'Access-Control-Allow-Origin' header in the response must not be the wildcard '*' when the request's credentials mode is 'include'.
Access to fetch at 'http://localhost:1111/api/collections/my_entity' from origin 'http://localhost:3000' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: The value of the 'Access-Control-Allow-Origin' header in the response must not be the wildcard '*' when the request's credentials mode is 'include'.
In the network tab I can see a CORS preflight exchange and the response is rejected by the browser. How do you handle it? The only header I provide is Authorization
3 Replies
Artur Owczarek
Artur OwczarekOP4mo ago
For me, the problem was the extra setting I didn't notice LLM has added to my Redux RTX setup while refactoring. I'll leave it here in case someone runs into the similar problem in the future.
export const api = createApi({
reducerPath: 'api',
baseQuery: fetchBaseQuery({
baseUrl,
prepareHeaders,
credentials: 'include', // <- REMOVE THIS
}),
tagTypes: ['User', 'MyEntities'],
endpoints: (builder) => ({
...userEndpoints(builder, "/api/collections/users"),
...otherEndpoints(builder, "/api/collections/myentities"),
}),
});
export const api = createApi({
reducerPath: 'api',
baseQuery: fetchBaseQuery({
baseUrl,
prepareHeaders,
credentials: 'include', // <- REMOVE THIS
}),
tagTypes: ['User', 'MyEntities'],
endpoints: (builder) => ({
...userEndpoints(builder, "/api/collections/users"),
...otherEndpoints(builder, "/api/collections/myentities"),
}),
});
brunobuddy
brunobuddy4mo ago
@Artur Owczarek did this solve your problem ? Were you using Cursor or something similar ?
Artur Owczarek
Artur OwczarekOP4mo ago
Yes, I've solved it. Thank you for asking. I'm using Cursor and it was it that added this property.

Did you find this page helpful?