This commit is contained in:
KZ
2015-07-20 22:08:05 +01:00
parent 07fe9d1e07
commit 4ec5815897
17 changed files with 430 additions and 52 deletions

View File

@@ -0,0 +1,32 @@
using Microsoft.Owin;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Jackett.Utils
{
public class WebApiRootRedirectMiddleware : OwinMiddleware
{
public WebApiRootRedirectMiddleware(OwinMiddleware next)
: base(next)
{
}
public async override Task Invoke(IOwinContext context)
{
var url = context.Request.Uri;
if (string.IsNullOrWhiteSpace(url.AbsolutePath) || url.AbsolutePath == "/")
{
// 301 is the status code of permanent redirect
context.Response.StatusCode = 301;
context.Response.Headers.Set("Location", "/Admin/Dashboard");
}
else
{
await Next.Invoke(context);
}
}
}
}