Ask coding questions

← Back to all posts
Unable to make API calls in React
iamritish (0)

I am trying to work on my React Learning project, which makes an API call over the server for the posts and other stuff.

But during the API call, the react is throwing an error "Not allowed to request resource".

While on local machine, it goes well. I guess there is some replit restriction for API calls. Can you please suggest a way to fix this issue.

Answered by RoBlockHead (530) [earned 5 cycles]
View Answer
RoBlockHead (530)

looks like your issue is that for the URL that you're fetching, it's an HTTP URL, which means that it isn't secure, you probably need to change your http:\//codial... URLs to be https://codial...

iamritish (0)

@RoBlockHead Actually, the url is not SSL secured and do not have https://. Can't we call the not secured API urls in replit?

RoBlockHead (530)

@iamritish any URLs are automatically secured, so you have to use HTTPS to contact them

iamritish (0)

@RoBlockHead Thank you for pointing the resolution.