Strapi v4 deployed to AWS EBS trying to load resource from localhost

I figured out what’s wrong. I was using the command strapi develop to run the application on the production server. This explains why the server attempts to load contents from localhost. The solution is there to change the run script to strapi start.