Hello, everyone! How are you?
I’ve built a simple React.js project and deployed it to netlify.com. cardano-bean.netlify.app
I used the HTTP request at the app as follows.
It works well on my local browser (npm run start), but after deploying to netlify.com, it can’t send the request and receive any response.
I am not sure why I get this result.
Please help me.
Okay, I’m assuming it’s the Buy now button you’re talking about.
So the error is, you’re connect to it over HTTP on a website with HTTPS. Browsers won’t allow that. This isn’t a Netlify limitation, it’s something not allowed by modern browsers. You would have to use HTTPS for that address.
That’s correct @Anna. Your site is served over HTTPS and therefore resources called (e.g. scripts, stylesheets, images, etc.) need to use the same protocol otherwise you get errors such as this in the console
Mixed Content: The page at 'https://cardano-bean.netlify.app/' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://159.89.188.76:3000/bean/redeem'. This request has been blocked; the content must be served over HTTPS.
The issue in your case then is that http://159.89.188.76:3000/ is not available over https (ie. https://159.89.188.76:3000) as it would appear it is not configured with SSL.
Hey Anna, probably too late for this but creating and configuring a _redirects file in the root of your build folder(or in your public folder if using an SPA like React) might help with this. For your example, in your case, the _redirects file would look something like this:
/api/* http://159.89.188.76:3000/:splat 200
Then rather than call endpoints like this:
fetch(`http://159.89.188.76:3000/bean/redeem?`)
You would need to make your API calls in this format:
fetch(`/api/bean/redeem?`) // 'it reads /api/ because of how we configured our _redirects file'
Hi, @kpavankumar. The person you mentioned hasn’t posted on this forum in over a year so they may not answer you.
Our support team can assist with troubleshooting this but we need to know which site this is about in order to do so. What is the site which is not working? Please send us the site subdomain or the site’s API ID and our support team will take a look.