- Newest
- Most votes
- Most comments
Is your Amplify site using HTTPS? If yes, it is not possible for a HTTPS site to request HTTP content because of mixed content security policy.
You can implement HTTPS proxy to fetch HTTP content. Your proxy code looks OK. I am not much of a Node developer, so apologies if my comments are incorrect.
I noticed that any request to http://api.geonames.org/ gets redirect to https://api.geonames.org which currently does not have a properly SSL/TLS cert installed. Can your configure your web request code to ignore cert error?
This may help
const options = { rejectUnauthorized: false }; // ignore cert error
url = "https://api.geonames.org/";
https.get(url, options);
Hi, It appears that you are hosting an SSG app using Amplify host and require a backend API to request data. Please note that Amplify does not provide servers for hosting your backend API (such as Express) unless you are hosting an SSR app like Next.js app from the Amplify console. In your case, I recommend using the Amplify REST API serverless solution (APIGateway + Lambda function). For more information, please refer to this documentation.
I will implement this, but I might have to use a different API
Relevant content
asked 3 months ago

Unfortunately it did not help, and I'm still not sure whether my
libbackend is being recognized or not.You will have to configure backend API as suggested by Leon