How do I make the different origin call from extension ? getting origin as 'null' on the ajax call

is it possible to make the cross-origin Ajax call inside the contentful extensions?
I have created an extension to get the data from apigee endpoint but on making Ajax call its throwing me the error of cross-origin.
when checked the request its sending origin as ‘null’?
can anyone able to help here?

1 Like

Hi @abhijit.kulkarni,

I think the issue here is that you’d have to enable cors headers on Apigee’s in order to allow such requests. I’m not familiar with their API, but do you think that’d be a possibility to enable this? It seems like they do have similar threads on their community as well.

Hi @gabriel,

We already have CORS handling in Apigee but requires origin to be excluded for CORS request.

The issue is that contentful is sending origin = null and we can not enable CORS for null.
Please read this link

You need to allow the null origin if the extension uses the srcdoc property so we host it.

Or you host the extension yourself using the src property so you can control the origin.