Good morning, I need to know how to solve a CORS problem, when request in RSC mode.
The SSR mode works perfectly, but when it is RSC it gives me a CORS error
This my client.js implementation, and i add the headers but doesnt work too.
import { ApolloClient, HttpLink, InMemoryCache } from '@apollo/client'
import { registerApolloClient } from '@apollo/experimental-nextjs-app-support/rsc'
export const { getClient } = registerApolloClient(() => {
return new ApolloClient({
cache: new InMemoryCache(),
link: new HttpLink({
uri: process.env.NEXT_PUBLIC_GRAPHQL_URI,
}),
headers: {
'Content-Type': 'application/json',
'Access-Control-Allow-Origin': '*',
'Access-Control-Allow-Methods': 'GET, POST, OPTIONS, PUT, PATCH, DELETE',
'Access-Control-Allow-Headers': 'Origin, X-Requested-With, Content-Type, Accept',
'Access-Control-Allow-Credentials': true,
},
})
})
And im getting this error: "Access to fetch at 'http://127.0.0.1:3001/api/graphql' from origin 'http://localhost:3001' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: It does not have HTTP ok status."
And in my next.config i added the headers too, but still not work.
Do you have any feedback for the maintainers? Please tell us by taking a one-minute survey. Your responses will help us understand Apollo Client usage and allow us to serve you better.
Good morning, I need to know how to solve a CORS problem, when request in RSC mode. The SSR mode works perfectly, but when it is RSC it gives me a CORS error
This my client.js implementation, and i add the headers but doesnt work too.
And im getting this error: "Access to fetch at 'http://127.0.0.1:3001/api/graphql' from origin 'http://localhost:3001' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: It does not have HTTP ok status."
And in my next.config i added the headers too, but still not work.