I currently have almost 500 image files in wwwroot/img folder. And my Git repository is bloated at the moment. I was wondering if there is a way to serve from another URL ?
I have another server where I can upload these images. A location like
However, I want to serve the static files but by creating my own path.
As an example: What if I want to serve images from www.anotherDomain.com/images as www.myapp/admin/images, so I am not exposing www.anotherDomain.com/images ?
In startup.cs, I have done the following
app.UseStaticFiles(new StaticFileOptions
{
FileProvider = new StreamConfigurationProvider( PhysicalFileProvider("www.anotherDomain.com/images"),
RequestPath = new Microsoft.AspNetCore.Http.PathString("/admin")
});
This is asking for an absolute path. Unfortunately, I can not map the network drive since the anotherDomain.com/images is hosted in an old VM (where I intend to upload all images) and my application is hosted on Azure App Service.