umbraco-community / UmbracoFileSystemProviders.Azure

:cloud: An Azure Blob Storage IFileSystem provider for Umbraco
96 stars 67 forks source link

Getting 404 on PDF files #23

Closed vonbv closed 8 years ago

vonbv commented 8 years ago

So we installed this fantastic package and everything is fine where images are served from the blob storage. The issue is with the pdf files. If we upload a pdf file to the Media section and later on click on it (Upload file field) the file is not available (error 404). The error make sense because the file has a URL of {our_domain}/media/xxxx/thefile.pdf where I think it should be something like http://{cdn_endpoint}/cache/assigned_storage_id?.PDF?

JimBobSquarePants commented 8 years ago

No it wouldn't be in the cache since it's not an image. Are the pdfs getting uploaded to blob storage?

vonbv commented 8 years ago

Yes, pdfs are getting uploaded. I can see it in the storage and can view the files if I use the blog storage URLs.

How can I tell Umbraco to use the blob storage URL so editors can view the file on the back-end?

JimBobSquarePants commented 8 years ago

With the plugin installed and the virtual path provider enabled as per the readme Umbraco should be able to retrieve the pdf by it's relative path. The plugin is an IFileSystemProvider implementation so Umbraco uses paths as normal.

e.g.

/media/1234/my-file.pdf
vonbv commented 8 years ago

Is it this one <add key="AzureBlobFileSystem.DisableVirtualPathProvider" value="false" />? Either value doesn't work. I still get a 404 and I think it's because the plugin is looking into the media folder that is empty.

Jeavon commented 8 years ago

Might be irrelevant but check your path and file name casing, Blobs are very case sensitive...

vonbv commented 8 years ago

Yeah the url is of the exact casing. Here's the behavior I'm getting. If I typed in {MY_DOMAIN}/media/xxxx/the_file.pdf I get a 404 and if I do {MY_DOMAIN}/media/xxxx/the_image.jpg then I got redirected to the cdn url. So the plugin does that right (at least the latter)? And so why it fails on the PDF?

oooshola commented 8 years ago

I had this issue as well and solved it here..

charlieanstey commented 7 years ago

Apologies for commenting in a closed issue but I am having a similar issue to @vonbv. I successfully installed UmbracoFileSystemProviders.Azure last week together with the latest ImageProcessor packages including the AzureCache plugin. All working fine, images are getting resized, cached, served from Azure CDN etc.

But PDFs are throwing 404 errors. Any links to /media/{id}/{filename}.pdf are not getting picked up/redirected to the blob storage or cache when the local /media/ folder is empty. If I put the local media folder back locally, works fine. Whilst this is in production for me, luckily I haven't as yet removed the local /media/ folder so it's not yet a major problem.

I've cross checked the configs against the examples, cleared caches, double checked casing, the blob names are media and cache as per @Jeavon's uHangOut video and all images are working hunky dory. I've double checked the StaticFile configs for /media/ as my issue is present in my updated LOCAL and DEV envs (both v7.7.5) as well as in my UAT and PROD envs (both 7.4.3).

I can post configs if necessary and perhaps even try a reduced test case though I've still got some hair left so not quite there yet ;) Any thoughts on something I've missed?