Images Not Accessible without Established Session

1
Hi all, There is something I noticed recently about viewing images from a URL in Mendix that I need some help figuring out. Viewing images uploaded through the modeler (via /img/filename) presents no issues because it references the image directly. However, when using the GUID to access an uploaded image (via /file?guid=xxxx), if there is no session already established for the app, the image is not returned. So for instance, if I tried the URL without having first visited the base URL of the app, nothing is returned. But, after hitting the base URL, the image can be retrieved from the image URL. Does anyone know of a way to get passed this limitation? Otherwise, are there any workarounds you would recommend?
asked
1 answers
1

The default behavior is indeed to protect your files using the built-in security mechanism. To view files you need a session, so that the runtime can determine whether you have the appropriate permissions.

A possible workaround would be to create your own custom requesthandler which sets the contenttype and simply outputs the bytestream to the file.

answered