mirror of https://github.com/Squidex/squidex.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
1.0 KiB
34 lines
1.0 KiB
// ==========================================================================
|
|
// Squidex Headless CMS
|
|
// ==========================================================================
|
|
// Copyright (c) Squidex UG (haftungsbeschraenkt)
|
|
// All rights reserved. Licensed under the MIT license.
|
|
// ==========================================================================
|
|
|
|
using System;
|
|
using System.Threading.Tasks;
|
|
using Microsoft.AspNetCore.Http;
|
|
using Microsoft.Extensions.Options;
|
|
|
|
namespace Squidex.Web.Pipeline
|
|
{
|
|
public class CleanupHostMiddleware
|
|
{
|
|
private readonly RequestDelegate next;
|
|
private readonly HostString host;
|
|
|
|
public CleanupHostMiddleware(RequestDelegate next, IOptions<UrlsOptions> options)
|
|
{
|
|
this.next = next;
|
|
|
|
host = new HostString(new Uri(options.Value.BaseUrl).Host);
|
|
}
|
|
|
|
public Task InvokeAsync(HttpContext context)
|
|
{
|
|
context.Request.Host = host;
|
|
|
|
return next(context);
|
|
}
|
|
}
|
|
}
|
|
|