Uploading Media is Not Working Probably

System Information
  • Strapi Version: 4.0.0
  • Operating System: Windows 10
  • Database: PostgreSQL
  • Node Version: 16

When I upload image on local it doesn’t show on the deployed app and vice versa can you explain how to fix this??

What is your upload provider? Can you give more details on your configuration?

After I’ve faced this problem I started to use AWS-S3 Provider and it worked just fine but here is the problem: when I upload any media (Locally or on the Server) I see this
Screenshot (140)
but when I access the photo from the url it works just fine so the problem in the preview how can I solve this?

You should replace strapi::security string with the object below in ./config/middlewares.js

    name: 'strapi::security',
    config: {
      contentSecurityPolicy: {
        useDefaults: true,
        directives: {
          'connect-src': ["'self'", 'https:'],
          'img-src': ["'self'", 'data:', 'blob:', 'yourBucketName.s3.yourRegion.amazonaws.com'],
          'media-src': ["'self'", 'data:', 'blob:', 'yourBucketName.s3.yourRegion.amazonaws.com'],
          upgradeInsecureRequests: null,

Where did you find this info @localhost_101 ? Can you point us to the docs?


Thank you soooo much you made my day!!!

1 Like