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

Hello @isfaaq Here is my decision on your case:

Go and edit: project root/config/middlewares.js and update your code:

module.exports = [
  "strapi::errors",
  {
    name: "strapi::security",
    config: {
      contentSecurityPolicy: {
        useDefaults: true,
        directives: {
          "connect-src": ["'self'", "https:"],
          "img-src": [
            "'self'",
            "data:",
            "blob:",
            "https://!!!BUKETNAME-EDIT!!!.amazonaws.com/",
          ],
          "media-src": ["'self'", "data:", "blob:"],
          upgradeInsecureRequests: null,
        },
      },
     
    },
  },
  "strapi::cors",
  "strapi::poweredBy",
  "strapi::logger",
  "strapi::query",
  "strapi::body",
  "strapi::favicon",
  "strapi::public",
  "strapi::session",
];

This solution works and has been tested with the latest version: 4.0.7

1 Like