Rendering GLB (3D Animations) files within Umbraco
Hi,
Hope somebody could help me with a strange issue within my Umbraco 11 Cloud project, I'm using a Media picker to load a GLB file, which is a 3D rendered interactive model like this https://modelviewer.dev, but I'm receiving a 404 error on the glb file. Has anybody used these files within Umbraco and can help me resolve this issue?
But I'm not quite sure on how to achieve it these days - Not sure if you can actually still use a web.config with the above in it since it should be picked up by the server assuming it's running on IIS - But since you're running cloud I guess it could perhaps work.
I don't know if there is a more "correct" way of doing it these days.
I've implemented that within the web.config but no joy. Also contacted Umbraco support, very helpful and supplied this possible solution:
I talked with the developers when it's Net.Core
You will need to do something like this I know its for another file format but its setup should be similar
I just added it by calling services.ConfigureOptions
public class MyStaticFileOptions : IConfigureOptions<StaticFileOptions>
{
public void Configure(StaticFileOptions options)
{
var provider = new FileExtensionContentTypeProvider();
provider.Mappings[".geojson"] = "application/json";
options.ContentTypeProvider = provider;
}
}
Rendering GLB (3D Animations) files within Umbraco
Hi,
Hope somebody could help me with a strange issue within my Umbraco 11 Cloud project, I'm using a Media picker to load a GLB file, which is a 3D rendered interactive model like this https://modelviewer.dev, but I'm receiving a 404 error on the glb file. Has anybody used these files within Umbraco and can help me resolve this issue?
And this renders out on the page as
Many thanks again for all your support
Hi Nick
My suspicion about this issue is that the server does not know the correct MIME type for the glb file.
So what I have been able to find out is that the mime type appears to be
model/gltf-binary
But I must admit that since we made the switch to .NET 5+ going from web.config til appsettings.json I'm not sure how to register new mime types.
Before it was usually a matter of doing the following in a web.config
But I'm not quite sure on how to achieve it these days - Not sure if you can actually still use a web.config with the above in it since it should be picked up by the server assuming it's running on IIS - But since you're running cloud I guess it could perhaps work.
I don't know if there is a more "correct" way of doing it these days.
Hope this guides you in the right direction.
/Jan
Thanks Jan,
I've implemented that within the web.config but no joy. Also contacted Umbraco support, very helpful and supplied this possible solution:
I talked with the developers when it's Net.Core You will need to do something like this I know its for another file format but its setup should be similar
https://github.com/dotnet/aspnetcore/issues/22477 Seems like they can just configure it https://learn.microsoft.com/en-us/aspnet/core/fundamentals/static-files?view=aspnetcore-7.0#fileextensioncontenttypeprovider
I just added it by calling services.ConfigureOptions
https://learn.microsoft.com/en-us/aspnet/core/fundamentals/static-files?view=aspnetcore-7.0#fileextensioncontenttypeprovider
And https://github.com/dotnet/aspnetcore/pull/22478/files
Unfortunately this also didn't work for me, no errors but no file rendered either :-(
This would work. I have checked. it's working fine.
is working on a reply...