i have an doubt, is CORS restricted in our hosting. I would like start a project were i run ajax api request to an API endpoint in script.js and it will need to access data from that API from response data. API will support cors, is there any issues or restriction with our hosting. As i have tested once it says origin ‘mydomain’ has been blocked by CORS.
Yes
IF is not an API host, you can’t do that here
I’m not hosting any API’s. I doing like for example fetching a data like file or json data from an example.com/getex endpoint using fetch(‘example.com/getex’, {method:‘POST’,}); i take that response into a variable this is in script.js. i’m just getting or saving or sending some data getting response data which is required in my website. I’m not hosting or doing anything on my IF hosting…
As I’m not familiar with all these exactly as of my knowledge the index.html and script.js which renders or run on client browsers. and i’m not using IF server-side scripting too. And i’m accessing an API from another API hosting like example railway, replit, and cloudflare workers etc… and some public API calls for data collection. (all these are example purpose i’m not using all these exactly but i’m starting new project that requires a function that run on serverless hosting functions) so can any one help me understand this if possible.
I think there won’t be any problematic if we use. if API server can support CORS header if it allows access to cross origin then you will able to receive the response data and you can achieve whatever you want…
Accessing external APIs from a website hosted with us is no problem. Hosting an API with us and accessing it from somewhere else is not possible.
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.