fix(web): open access error page content type

This commit is contained in:
genteure 2024-03-17 20:37:03 +08:00
parent ec6d3d35c2
commit c428086ccb

View File

@ -1,6 +1,5 @@
using System;
using System.IO;
using System.Linq;
using System.Net;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
@ -29,7 +28,7 @@ namespace BililiveRecorder.Web
if (sourceIpNotLan(context) || haveReverseProxyHeaders(context) || haveCustomHostValue(context))
{
context.Response.StatusCode = 412;
var accept = context.Request.Headers[HeaderNames.Accept];
var accept = context.Request.Headers[HeaderNames.Accept].ToString();
if (accept.Contains("text/html"))
{
context.Response.ContentType = "text/html; charset=utf-8";