jakeFeldman / strapi-provider-upload-azure-storage

Strapi Provider Upload Azure Storage
MIT License
75 stars 42 forks source link

Incorrect Url when using CDN #54

Closed TheHuns closed 1 year ago

TheHuns commented 2 years ago

I was able to get everything setup and working properly at first when omitting the STORAGE_CDN_URL. After going back and adding that config, the upload works well and I can see the images in the storage container. However, the url provided to get the asset is incorrect.

Our CDN URL points to a specific container which may be part of the issue.

ex. https://images.example.com/images/folder/some-image.jpg

Here the /images/ is trying to point at the container but the base url is already do so and I get a 404 error

<Error
>
<Code
>
BlobNotFound
</Code
>
<Message
>
The specified blob does not exist.
RequestId:41e515d8-001e-0049-25bf-dcfcf2000000
Time:2022-10-10T15:48:38.6512325Z
</Message
>
</Error>

Ideally the url would just be https://images.example.com/folder/some-image.jpg

Is there a way to edit this in the middleware or plugin config? Thanks!

Versions

strapi: 4.3.6 strapi-provider-upload-azure-storage: 2.1.0

rvdkooy commented 1 year ago

HI, any update on this? we're experiencing the same issue. we're also using the CDN url, but the CDN is typically pointing to a container already

@TheHuns did you find a solution for this?

TheHuns commented 1 year ago

@rvdkooy I did get it working but I forget now exactly what it was. Here is what I have in the config/plugins.js


module.exports = ({ env }) => ({
...
 upload: {
    config: {
      provider: "strapi-provider-upload-azure-storage",
      providerOptions: {
        account: env("STORAGE_ACCOUNT"),
        accountKey: env("STORAGE_ACCOUNT_KEY"),
        serviceBaseURL: env("STORAGE_URL"),
        containerName: env("STORAGE_ACCOUNT_CONTAINER"),
        cdnBaseURL: env("STORAGE_CDN_URL"),
        defaultPath: "",
        maxConcurrent: 10,
      },
    },
  },
...
})

Sorry I don't remember exaclty but feel like it was one of these settings 
rvdkooy commented 1 year ago

thanks!. a similar issue can be found here: https://github.com/jakeFeldman/strapi-provider-upload-azure-storage/issues/38