different api routing
This commit is contained in:
@@ -2,12 +2,12 @@
|
|||||||
using Microsoft.AspNetCore.HttpOverrides;
|
using Microsoft.AspNetCore.HttpOverrides;
|
||||||
|
|
||||||
var builder = WebApplication.CreateBuilder(args);
|
var builder = WebApplication.CreateBuilder(args);
|
||||||
builder.Services.Configure<ForwardedHeadersOptions>(options =>
|
//builder.Services.Configure<ForwardedHeadersOptions>(options =>
|
||||||
{
|
//{
|
||||||
options.ForwardedHeaders =
|
// options.ForwardedHeaders =
|
||||||
ForwardedHeaders.XForwardedFor |
|
// ForwardedHeaders.XForwardedFor |
|
||||||
ForwardedHeaders.XForwardedProto;
|
// ForwardedHeaders.XForwardedProto;
|
||||||
});
|
//});
|
||||||
|
|
||||||
// Add services to the container.
|
// Add services to the container.
|
||||||
// Learn more about configuring OpenAPI at https://aka.ms/aspnet/openapi
|
// Learn more about configuring OpenAPI at https://aka.ms/aspnet/openapi
|
||||||
@@ -15,22 +15,21 @@ builder.Services.AddOpenApi();
|
|||||||
|
|
||||||
var app = builder.Build();
|
var app = builder.Build();
|
||||||
|
|
||||||
app.UseForwardedHeaders();
|
|
||||||
|
|
||||||
// Configure the HTTP request pipeline.
|
// Configure the HTTP request pipeline.
|
||||||
if (app.Environment.IsDevelopment())
|
if (app.Environment.IsDevelopment())
|
||||||
{
|
{
|
||||||
app.MapOpenApi();
|
app.MapOpenApi();
|
||||||
}
|
}
|
||||||
|
|
||||||
//app.UseHttpsRedirection();
|
//app.UseForwardedHeaders();
|
||||||
|
app.UseHttpsRedirection();
|
||||||
|
|
||||||
var summaries = new[]
|
var summaries = new[]
|
||||||
{
|
{
|
||||||
"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
|
"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
|
||||||
};
|
};
|
||||||
|
|
||||||
app.MapGet("api/weatherforecast", () =>
|
app.MapGet("weatherforecast", () =>
|
||||||
{
|
{
|
||||||
var forecast = Enumerable.Range(1, 5).Select(index =>
|
var forecast = Enumerable.Range(1, 5).Select(index =>
|
||||||
new WeatherForecast
|
new WeatherForecast
|
||||||
|
|||||||
Reference in New Issue
Block a user