I deployed a ASP.net core swagger API in Azure K8s cluster when im verifying it reaching the main page using curl -I localhost:5100 i got error 404 while when im trying curl -I locolhost:5100/index.html i got the respond 200.
what could be causing this problem knowing this my startup class
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
var healthCheckOptions = new HealthCheckOptions
{
ResponseWriter = WriteReadinessResponse
};
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
app.UseRouting();
app.UseAuthorization();
app.UseEndpoints(endpoints =>
{
endpoints.MapControllers();
endpoints.MapHealthChecks("/health/readiness", healthCheckOptions);
endpoints.MapHealthChecks("/health/liveness", new HealthCheckOptions()
{
Predicate = (_) => false
});
});
// enable swagger support
app.UseSwagger();
app.UseSwaggerUI(c =>
{
c.RoutePrefix = string.Empty;//all request to route [/] are being forward to index.html somehow
c.SwaggerEndpoint("/swagger/v1/swagger.json", "Demo API V1");
});
}
is there a way how to fix this ? I like to get respond 200 when I curl -I localhost:5100.