CORS issue #692
Unanswered
jktittalom
asked this question in
General
CORS issue
#692
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,

I have installed CKAN and PortalJs in local both are working. But I am getting following error in the Home screen while loading stats:
e.g. Access to fetch at 'http://localhost:5000/api/3/action/package_search?rows=0' from origin 'http://localhost:3000' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: 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.
I have added following in the lab/apolloClient.ts:
const restLink = new RestLink({
uri: getConfig().publicRuntimeConfig.DMS + '/api/3/action/',
headers: {
'Access-Control-Allow-Origin':'*',
'Access-Control-Allow-Credentials':'true',
'Accept':'application/json',
'Accept-Language':'en-US',
'Content-Language':'en-US',
'Content-Type': 'application/json',
'mode': 'no-cors',
'Access-Control-Allow-Methods':'GET,POST,OPTIONS,DELETE,PUT',
'Referrer-Policy':'no-referrer',
'Connection':'Keep-Alive',
'Access-Control-Allow-Headers':'Origin, X-Requested-With, Content-Type, Accept',
},
But still it showing CORS related issue. Well in home page I can see recent dataset from CKAN but seeing issue getting data for search related data only.
Please share solution.
Thanks,
Beta Was this translation helpful? Give feedback.
All reactions