I have a Dot Net Core Web API developed , deployed and running in Azure. It serves as API Gateway for now. I would like to serve HTML content when user hits the root of the url in browser.
And our website content is published to azure storage behind CDN with Static Web Site. I followed the steps from below link and set it up.
https://microsoft.github.io/AzureTipsAndTricks/blog/tip203.html
How do we serve this content in my dot net core web api from azure storage and return that content to browser. Please note that my SPA refers to the same API for data.
I could do this easily if my front end project in the same directory as the web api project but our build pipeline publishes it to the azure storage to leverage CDN.
I have the below code i copied from msdn blog which gives any idea how to include static content.
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
else
{
app.UseExceptionHandler("/Home/Error");
app.UseHsts();
}
app.UseHttpsRedirection();
app.UseStaticFiles();
app.UseRouting();
app.UseAuthorization();
app.UseEndpoints(endpoints =>
{
endpoints.MapDefaultControllerRoute();
});
}
I am trying to follow the architecture with ocelot as suggested in the answer 2 below.
https://stackoverflow.com/questions/53477140/asp-net-core-api-gateway-middleware
My main question is
Should i read the content of azure storage under static website blob and return it which i feel a bit of processing
or
just do the redirection to Static WebSite or CDN url link.
or
host the website as azure static website or CDN ? If hosteed as Azure Static Website does it support https custom domain/host name mapping ?